[Twisted-Python] XML parsing on twisted

gary clark burslem2001 at yahoo.com
Sat Oct 3 16:30:15 MDT 2009


Hello,

I went to use the SAX library to perform parsing. However I hit an unusual
problem.

Its having a problem parsing a token that has a '&' it just crashes. It certainly woke me up when I witnessed this.

<books> Jim & Nancy </books>

are passed to the ContentHandler class. When characters(self,chars) member gets called I perform self.book+=chars to reassemble the string.

I dump out the self.book string as its being assembled. If I replace the '&' character with "and" then its Ok. Of course I dont want to have to replace '&' with 'and'.

Not good. So has anybody else seen this problem. I'm assuming it thinks its a reference and becomes confused when I attempt to add a reference.

Much appreciated,
Garyc





More information about the Twisted-Python mailing list