On Thu, May 27, 2010 at 9:13 PM, Robert Kern <robert.k...@gmail.com> wrote: > ElementTree writes exactly what you tell it to. In XML, whitespace is > significant. If you want newlines and/or indentation to make it > pretty-looking, then you need to add those to your elements.
This is not always true. Let me quote an XML tutorial (by Oracle): "What is XML Whitespace? XML considers four characters to be whitespace: the carriage return (\r or ch(13)), the linefeed (\n or ch(10)), the tab(\t), and the spacebar (' '). In XML documents, there are two types of whitespace: Significant whitespace is part of the document content and should be preserved. Insignificant whitespace is used when editing XML documents for readability. These whitespaces are typically not intended for inclusion in the delivery of the document. Usually without DTD or XML schema definition, all whitespaces are significant whitespaces and should be preserved. However, with DTD or XML schema definitions, only the whitespaces in the content are significant as follows: <sig> ------------------ John Smith Product Manager Example.com -------------------- </sig> " -- http://mail.python.org/mailman/listinfo/python-list