Tue, 17 Dec 2002 08:53:21 -0700
> I've got the following problem:
> If I save the following xml file using PrettyPrint()
> <?xml version="1.0"?>
> I get:
> <?xml version='1.0' encoding='UTF-8'?>
> Now next time I read in the xml, a new text node is created in the DOM tree
> due to the indent an newline behind the first <raw> element.
> I could use Print since it doesn't add any additional data. But Pretty is more
> pretty ;-)
> I'm not sure about ignorable whitespace in xml, but I think, it is not
> Shouldn't the output be ...<raw><![CDATA[foo]]></raw>...?
No. A pretty printer is expected to produce output that may have different
white space usage from a plain printer. This is the whole point of a pretty
printer. If you don't like that effect, then you should use a plain printer.
Can't really have it both ways unless you design a pretty printer specific to
your own format.
I think you may be able to get closer to what you want with
But I'm not sure that it gets you all the way.
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
A Python & XML Companion - http://www.xml.com/pub/a/2002/12/11/py-xml.html
XML class warfare - http://www.adtmag.com/article.asp?id=6965
MusicBrainz metadata - http://www-106.ibm.com/developerworks/xml/library/x-thi