Re: xml.sax removing newlines from attribute value?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: xml.sax removing newlines from attribute value?

From: Fredrik Lundh <fredrik@pythonware.com>
Date: Thu Sep 29 2005 - 20:20:06 CEST

Grant Edwards wrote:

> I'm using xml.sax to parse the "datebook" xml file generated by
> QTopiaDesktop. When I look at the xml file, some of the
> attribute strings have newlines in them (as they are supposed
> to).
>
> However, when xml.sax passes the attributes to my
> startElement() method the newlines seem to have been deleted.
>
> How do I get the un-munged element attribute values?

newlines as in chr(10) rather than &#xa; ?

if so, the only way is to avoid XML:

    http://www.w3.org/TR/REC-xml/#AVNormalize

if the "yes, I know, but I have good reasons" approach is okay with you,
and you're big enough to defend yourself against the XML-Is-The-Law
crowd, you can use a "sloppy" XML parsers such as sgmlop to deal with
your files:

    http://effbot.org/zone/sgmlop-index.htm

</F>
Received on Sat Oct 15 03:57:19 2005