Answer the question
In order to leave comments, you need to log in
How to align XML structure?
How to align XML text structure? That is, there is XML text in this form:
<?xml version="1.0" ?> <message> <report> <station ID="100" Name="main"/> <parameter VAR=A1> 100 </parameter> <parameter VAR=A2> 200 </parameter> </report> </message>
<?xml version="1.0" ?>
<message>
<report>
<station ID="100" Name="main"/>
<parameter VAR=A1>
100
</parameter>
<parameter VAR=A2>
200
</parameter>
</report>
</message>
Answer the question
In order to leave comments, you need to log in
from xml.dom import minidom
pretty = minidom.parseString('str').toprettyxml()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question