Fromatting an xml file

Harry George harry.g.george at boeing.com
Fri Feb 3 10:09:27 EST 2006


"sir_alex" <chimaera29 at libero.it> writes:

> Hi! I have a little problem writing xml files formatted in a way like
> the following:
> 
> <rootnode>
>          <node>bla</node>
>          <node>bla</node>
> </rootnode>
> 
> Every new node element should have a tabulation before it, but when I
> use xml.dom.minidom I use writexml, which considers as a new node also
> the text (in my little example, "bla" phrases), so the best result I
> achieved has been the following
> 
> <rootnode>
>         <node>
>                  bla
>         </node>
> </rootnode>
> 
> but I don't want the text to be written on newlines... is there a good
> solution? Thanks!
> 

Based on recommendations from this newsgroup, I write XML directly,
instead of going through DOM.  That in turn requires a mechanism for
tabbed indents, so I wrote tabbedwriter:

http://www.seanet.com/~hgg9140/comp/index.html
http://www.seanet.com/~hgg9140/comp/tabbedwriter/doc/tabbedwriter.help


-- 
harry.g.george at boeing.com 6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718



More information about the Python-list mailing list