formatted xml output from ElementTree inconsistency

Matthew Thorley ruach at
Thu Jun 23 23:29:31 CEST 2005

Jarek Zgoda wrote:
> Matthew Thorley napisał(a):
>> The output I get shows xmla as nicely formatted text, with elements on 
>> different lines and everything all tabbed and pretty. Inverly, xmlb is 
>> one long string on one line.
>> Is that because the some_file.xml is already nicely formatted? I 
>> thought that the formatting was ignored when creating new elements.
> Why want you to read an XML document "by hand"? It's a "machine related" 
> data chunk.
> Document formatting should be done by means of CSS and/or XSL stylesheet.
It is just data to the machine, but people may have to read and 
interpret this data. I don't think there is anything unsual about 
formatting xml with tabs. Most web pages  do that in their html/xhtml. 
Just imagine if you wanted to change a broken link on your web page, and 
the entire page was one long string. That may not matter to Dream 
Weaver, but it sure would be annoying if you were using vi :)


More information about the Python-list mailing list