Reviewlet of XML Processing With Python by S.McGrath

effbot at pythonware.com effbot at pythonware.com
Sat Sep 9 06:04:27 EDT 2000


steven wrote:
> As far as PYX is conserned, I agree that it could be simpler. I
> have to assume that the designers had a reason for including
> "-\n", but I can't figure it out either.

Unless you're using a validating parser and a DTD, you
cannot throw away whitespace.  See section 2.10 of the
XML specification:

    "An XML processor must always pass all characters
    in a document that are not markup through to the
    application"

After all, someone might need those extra newlines. For
example:

    <pre>
       <b>hello</b>
       <i>world</i>
    </pre>

isn't quite the same thing as:

    <pre><b>hello</b><i>world</i></pre>

</F>

<!-- daily news from the python universe:
http://www.pythonware.com/daily/index.htm
-->


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list