formatted xml output from ElementTree inconsistency

Patrick Maupin pmaupin at
Fri Jun 24 22:53:43 CEST 2005

Jarek Zgoda wrote:

> Why want you to read an XML document "by hand"? It's a "machine related"
> data chunk.

I see this attitude all the time, and frankly I don't understand it.
Please explain why XML is in ASCII/unicode instead of binary.  Is it
because it is easier for a machine to parse?  No, I thought not.  It's
obviously so humans can read it.  The next question is:  why is
arbitrary whitespace allowed?  Is that to make it easier for machines
to parse?  Is it any easier for machines to generate arbitrary
whitespace than it would have been for them to always insert, e.g., a
single space?  No, I thought not there as well.

> Document formatting should be done by means of CSS and/or XSL stylesheet.

He's not formatting the (rendered) document -- he's just formatting the
raw data to make it more readable in an editor.  You could use CSS/XSL,
and then selectively add whitespace without actually affecting the
rendering.  Alternatively, as you point out, it is a "machine related"
data chunk -- some XML documents are never even destined for human
eyes, _except_ for debugging.  For some of those documents, CSS and XSL
are just a waste of CPU cycles.


More information about the Python-list mailing list