[XML-SIG] Help Needed with Element Tree

Fredrik Lundh fredrik at pythonware.com
Wed Jan 25 08:35:25 CET 2006


Vishal Bhargava wrote:

> I have an XML format that I have created using data collected from
> Different dictionaries. I am changing the file extension of this XML file
> to something else, e.g. .wml extension, so when I open this file using
> notepad the whole file is totally flat, that means the all the data that I
> have in the XML file whose extension I just changed gets printed out into 1
> single line. Is there no way that we can take care of formatting the file,
> during the building of the XML file using the Element Tree Module. Thanks
> for all the help.

the file is perfectly valid XML, even if it doesn't contain any extra newlines.
if you want it to print more nicely, you can set the "tail" attribute to "\n" for
relevant elements.  or you can run something like the snipped in this post

    http://article.gmane.org/gmane.comp.python.xml/3741

before you save the file.

</F>





More information about the XML-SIG mailing list