[IMP]XML write : pretty print for py2
This commit is contained in:
parent
4744b46ba8
commit
bb5c3a8cb8
@ -61,9 +61,10 @@
|
|||||||
"Write XML file according to filename and given tree"
|
"Write XML file according to filename and given tree"
|
||||||
`(do
|
`(do
|
||||||
(import [os [path]]
|
(import [os [path]]
|
||||||
[xml.etree.ElementTree :as ET])
|
[xml.etree.ElementTree :as ET]
|
||||||
|
[xml.dom [minidom]])
|
||||||
(if-python2
|
(if-python2
|
||||||
(setv ~g!output-xml (.tostring ET ~tree))
|
(setv ~g!output-xml (.toprettyxml :indent " " (.parseString minidom (.tostring ET ~tree))))
|
||||||
(setv ~g!output-xml (.decode (.tostring ET ~tree) "utf-8")))
|
(setv ~g!output-xml (.decode (.tostring ET ~tree) "utf-8")))
|
||||||
(setv ~g!output-path (.dirname path (.abspath path __file__))
|
(setv ~g!output-path (.dirname path (.abspath path __file__))
|
||||||
~g!fpath (+ ~g!output-path "/" ~filename))
|
~g!fpath (+ ~g!output-path "/" ~filename))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user