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


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

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

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?

Thanks, César

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