Fred L. Drake, Jr.
Tue, 3 Dec 2002 17:56:29 -0500
Gordon Webster writes:
> Following the example in the library reference for the
> xml.parsers.expat module, I created a parser, defined
> handlers for the start and end of XML tags and for
> character data.
Gak! There's a tiny but possibly relevant error in the example. ;-(
Just calling the Parse() method with data causes the parser to expect
more data; to tell it you're done, you need to call Parse() with the
optional second argument set to true (an empty data string is fine):
This tells the parser that there isn't any more input, so anything
that hasn't been reported will be reported.
(I'll fix the documentation.)
Now, if you've passed the complete document already, this shouldn't be
a real problem in practice. If this doesn't fix it for you, please
provide specific code and a sample document that exhibit this problem,
and the exact error you're seeing. That will make it much easier to
Fred L. Drake, Jr. <fdrake at acm.org>
PythonLabs at Zope Corporation