[XML-SIG] losing cdata tag
Martin v. Loewis
martin@v.loewis.de
30 May 2002 00:44:35 +0200
Paul Tremblay <phthenry@earthlink.net> writes:
> >>> from xml.sax import sax2exts
> >>> p =sax2exts.make_parser()
> >>> print p
> <xml.sax.expatreader.ExpatParser instance at 0x81e06a4>
>
> So it seems like I'm using expat, and it is likely that I could
> be using an outdated version(?) (Also, how come when I do $which
> expat, I get "no expat found...etc?)
Unlikely. Expat ships with PyXML, and PyXML normally uses the included
expat.
There is not much point in guessing what software configuration might
have gone wrong; instead, it is more productive finding out why your
installation does not work correctly. As a starting point, locate the
copy of expatreader.py that you are using, and edit the function
def _reset_lex_handler_prop(self):
self._parser.CommentHandler = self._lex_handler_prop.comment
self._parser.StartCdataSectionHandler = self._lex_handler_prop.startCDATA
self._parser.EndCdataSectionHandler = self._lex_handler_prop.endCDATA
to read
def _reset_lex_handler_prop(self):
print "Resettint the lexical handler", self._lex_handler_prop.startCDATA
self._parser.CommentHandler = self._lex_handler_prop.comment
self._parser.StartCdataSectionHandler = self._lex_handler_prop.startCDATA
self._parser.EndCdataSectionHandler = self._lex_handler_prop.endCDATA
Then report whether this prints anything. If it does, report what it
prints; if it doesn't, locate
def reset(self):
print "print ADDED: reset"
...
if self._lex_handler_prop:
print "print ADDED: reset_lex_handler_prop"
self._reset_lex_handler_prop()
Regards,
Martin