Reputation: 11
I'm trying to append a new child on a XML file, the problem is that I can't give the appropriate format to the child before inserting it in the XML document.
I Have created the child with minidom.Document()
and then appendChild
to books.
Do I explained well?
Thanks in advance.
Upvotes: 1
Views: 2453
Reputation: 10205
Indentation of snippets of XML is a tricky business for XML processors: they are allowed to perform many transformation that you would not expect and they are not allowed to reindent elements in the way you would like without your explicit consent.
Have a look at Pretty printing XML in Python to see how you can indent a full XML document.
Upvotes: 2