[XML-SIG] xml.dom.minidom.toprettyxml whitespace question

Andy Meyer andy at itasoftware.com
Mon Jan 3 19:29:43 CET 2005

Hello all,

I have a question about the xml.dom.minidom.toprettyxml method's 
insertion of whitespace into text elements, e.g. 
'<foo><bar>Hello!</bar></foo>' getting transformed by toprettyxml to:


with the addition of tabs and newlines around 'Hello!', instead of:


Since a SAX-style parser would read the second example as identical to 
the raw XML, to me the second way is more correct than the first, but 
I'm new to XML and handling whitespace seems to be an unresolved issue. 
Is this behavior by design?

Andy Meyer

More information about the XML-SIG mailing list