If I have a file like so for example:
<data>
<country name="Liechtenstein">
<rank>1</rank>
<year>2008</year>
<gdppc>141100</gdppc>
<neighbor direction="E" name="Austria" />
<neighbor direction="W" name="Switzerland" />
</country>
</data>
And if I append an element:
newTagContentString = """
<usertype id="99999">
<role name="admin" />
</usertype>"""
c.append(newXMLElement)
It isn't properly indentated:
<data>
<country name="Liechtenstein">
<rank>1</rank>
<year>2008</year>
<gdppc>141100</gdppc>
<neighbor direction="E" name="Austria" />
<neighbor direction="W" name="Switzerland" />
</country>
<usertype id="99999">
<role name="admin" />
</usertype></data>
Is there a way to make it properly indentate?
BTW c.insert(0, newXMLElement)
also doesn't keep nice spacing:
<data>
<usertype id="99999">
<role name="admin" />
</usertype><country name="Liechtenstein">
<rank>1</rank>
<year>2008</year>
<gdppc>141100</gdppc>
<neighbor direction="E" name="Austria" />
<neighbor direction="W" name="Switzerland" />
</country>
</data>