toprettyxml messes up with whitespaces

Jorgen Bodde jorgen.maillist at gmail.com
Tue Oct 9 05:20:23 EDT 2007


Dear list,

Thanks for the suggestions and clarification. After playing with XML
for a while I noticed whitespaces can indeed be more important then I
thought. I did came to the following conclusions;

1. Removing whitespaces was done by my code, not by the
xml.dom.minidom so I regret the fact I said that it removed
whitespaces automatically
2. toprettyxml() should however be smarter with outputting the XML. If
it adds whitespaces in the sake of formatting, it should check how
many of the whitespaces are already there. Consecutive read / modify /
write actions should not cause an explosive growth of whitespaces.
When I use toprettyxml() I am obviously not interested in whitespaces
in front of the text in the nodes, or else I would have outputted it
differently.

Thanks all for the feedback,
- Jorgen



More information about the Python-list mailing list