how can i change the appearance of my xml from e.g
<root>
<elem1>
<value>
122
</value>
<text>
This_is_just_a_text
</text>
</elem1>
<elem1>
<value>
122
</value>
<text>
This_is_just_a_text
</text>
</elem1>
</root>
to something look like:
<root>
<elem1>
<value>122</value>
<text>This_is_just_a_text</text>
</elem1>
<elem1>
<value>122</value>
<text>This_is_just_a_text</text>
</elem1>
</root>
I'm just wondering what cause that to happen? and by the way the below method/function is used to add the indents!
def prettify(elem):
"""
Return a pretty-printed XML string for the Element.
"""
rough_string = ET.tostring(elem, 'utf-8')
reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent="\t")