xml.sax problem: getting parse() to read a string

Fredrik Lundh fredrik at pythonware.com
Mon Jun 5 16:15:39 EDT 2006


sturnfie at gmail.com wrote:

> I am getting the following error.
> 
> File "acmtest.py", line 205, in parseMessage
>     parser.parseString(message)
> AttributeError: ExpatParser instance has no attribute 'parseString'
> 
> Am I simply missing that library here?  Or am I calling it incorrectly?

as mentioned in the documentation, and implied by my answer, parseString 
is a helper function in the xml.sax module, not a parser method.  try doing

     xml.sax.parseString(string, handler)

instead of that make_parser/setContentHandler/parse dance.

</F>




More information about the Python-list mailing list