Code
I'm writing an xml file with cElementTree like this:
cElementTree.ElementTree(xml_tree]).write(xmlPath, encoding="ISO-8859-1", xml_declaration=True)
actual result
This gives the following file (on Windows):
<?xml version='1.0' encoding='iso-8859-1'?><tag1 = "1"></tag1>
So the newlines are missing.
I tried adding the appropiate windows newline characters \r\n
'by hand', now I get this:
<?xml version='1.0' encoding='iso-8859-1'?><tag1 = "1">
</tag1>
desired result
However, I would like to have the correct newline character after each line, so that my output should look this:
<?xml version='1.0' encoding='iso-8859-1'?>
<tag1 = "1">
</tag1>
How can I achieve that?