Hi Jorgen,

> I parse an XML file, replace a node with a new one (like updating cache)
> and write it back. Every write, new spaces are added.
[ ... ]
> And this goes on. The node is one that is not touched in the XML, it is
> simply written back after reading. I have the same with void spaces in
> between the nodes, I managed to compensate that by stripping the lines.

Before calling toxml/toprettyxml, I strip (with rstrip and lstrip) all 
text nodes and take care of removing all the empty ones.

Of course, this is feasible only if whitespace (space, tab, newline) is
not meaningful for the application.

Legrandin
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to