Re: [xml] How to know that the parser has stopped (or aborted) in python

On Wed, Feb 08, 2006 at 05:59:53PM +0100, Cesar Ortiz wrote:

Perhaps I should ask this to
xml-bindings gnome org<>but
looking into the archives, they are quite old. Is that list still
Anyway I have not manage to find something useful...

Looking at C examples that uses the function htmlParseChunk  I have seen

ctxt = htmlCreatePushParserCtxt(
SAXHandler, &abort, buf, res, argv[1], 0);

while ( !abort && (res = fread(buf, 1, 2048, f)) > 0)
  htmlParseChunk(ctxt, buf, res, 0);

Checking 'abort', you know that something has gone wrong and you have to
stop to pushing chunks to the parser.  How you should do this in python?

  you're using the HTML parser, which should never abort basically.
The notion of fatal error where the parser stops emitting data (just more
error message) exists only in the XML parser.


Daniel Veillard      | Red Hat
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]