I\'m currently using the toprettyxml() function of the xml.dom module in a Python script and I\'m having some trouble with the newlines. If don\'t
toprettyxml()
xml.dom
If you don't mind installing new packages, try beautifulsoup. I had very good experiences with its xml prettyfier.