Note that there are some explanatory texts on larger screens.

plurals
  1. POPython minidom unwanted whitespace
    primarykey
    data
    text
    <p>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:</p> <pre><code>&lt;AantalTicketsPerUur&gt; &lt;Dag datum="2012-03-16"&gt; &lt;Aantal_tickets Aantal="24" uurinterval="0u-1u"/&gt; &lt;Aantal_tickets Aantal="68" uurinterval="1u-2u"/&gt; &lt;Aantal_tickets Aantal="112" uurinterval="2u-3u"/&gt; &lt;Aantal_tickets Aantal="98" uurinterval="3u-4u"/&gt; &lt;/Dag&gt; &lt;/AantalTicketsPerUur&gt; </code></pre> <p>becomes this (the elements without that whitespace inbetween are the new data): </p> <pre><code>&lt;AantalTicketsPerUur&gt; &lt;Dag datum="2012-03-16"&gt; &lt;Aantal_tickets Aantal="24" uurinterval="0u-1u"/&gt; &lt;Aantal_tickets Aantal="68" uurinterval="1u-2u"/&gt; &lt;Aantal_tickets Aantal="112" uurinterval="2u-3u"/&gt; &lt;Aantal_tickets Aantal="98" uurinterval="3u-4u"/&gt; &lt;/Dag&gt; &lt;Dag datum="2012-03-16"&gt; &lt;Aantal_tickets Aantal="24" uurinterval="0u-1u"/&gt; &lt;Aantal_tickets Aantal="68" uurinterval="1u-2u"/&gt; &lt;Aantal_tickets Aantal="112" uurinterval="2u-3u"/&gt; &lt;Aantal_tickets Aantal="98" uurinterval="3u-4u"/&gt; &lt;/Dag&gt; &lt;/AantalTicketsPerUur&gt; </code></pre> <p>How can I solve this? NOTE: I DO USE THE .toprettyxml() method</p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload