I'm using Python to write data into .xml files. I have this file named statistics.xml and everytime I call my method 'writeIntoXml()' it should add data to that statistics xml-file. Now Python does this perfectly, the only problem is it adds unwanted whitespace between all of my elements that were in the file before I wrote the new data into it. Like this:
<AantalTicketsPerUur>
<Dag datum="2012-03-16">
<Aantal_tickets Aantal="24" uurinterval="0u-1u"/>
<Aantal_tickets Aantal="68" uurinterval="1u-2u"/>
<Aantal_tickets Aantal="112" uurinterval="2u-3u"/>
<Aantal_tickets Aantal="98" uurinterval="3u-4u"/>
</Dag>
</AantalTicketsPerUur>
becomes this (the elements without that whitespace inbetween are the new data):
<AantalTicketsPerUur>
<Dag datum="2012-03-16">
<Aantal_tickets Aantal="24" uurinterval="0u-1u"/>
<Aantal_tickets Aantal="68" uurinterval="1u-2u"/>
<Aantal_tickets Aantal="112" uurinterval="2u-3u"/>
<Aantal_tickets Aantal="98" uurinterval="3u-4u"/>
</Dag>
<Dag datum="2012-03-16">
<Aantal_tickets Aantal="24" uurinterval="0u-1u"/>
<Aantal_tickets Aantal="68" uurinterval="1u-2u"/>
<Aantal_tickets Aantal="112" uurinterval="2u-3u"/>
<Aantal_tickets Aantal="98" uurinterval="3u-4u"/>
</Dag>
</AantalTicketsPerUur>
How can I solve this? NOTE: I DO USE THE .toprettyxml() method
Thanks in advance