Remove whitespaces and line breaks in a XML file

David Vicente dvicente at full-on-net.com
Mon Feb 7 18:45:31 CET 2011


Hi,

 

I´m parsing an xml file with xml.etree. It works correctly, but I have a
problem with the text attribute of the elements which should be empty. For
example, in this case:

<book>

                <author>Ken<author>

</book>

 

The text element of “book” should be empty, but it returns me some
whitespaces and break lines. I can´t get remove these whitespaces without
remove information. 

 

Some idea?

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110207/3498316f/attachment.html>


More information about the Python-list mailing list