Re: [xml] Error handling on a per-parser base

On Thu, 28 Oct 2010 18:27:54 +0200, Daniel Veillard wrote
On Mon, Oct 25, 2010 at 09:09:03PM +0000, Ralf Mattes wrote:
Hello list,

is it possible to register a custom error function per xmlParserCtxtPtr
created by xmlCreatePushParserCtxt? I'd like to parse documents in 
parallel and would need error reporting per parser context. Dispatching
on user_data in the error callback seems inside out.

  You can set the ctxt->sax->serror assuming a SAXv2 to set a structured
error handler. But in general the disambiguation will be done based 
on the context not based on the function.

Hm, I don't seem to understand: what context are you talking about, the
xmlParserCtxt I created, or the userdata context I provide as the first
parameter to xmlSetGenericErrorFunc and the like?
Setting a general 
strcutured error handler should then allow this.  But note that some 
errors may occur in part of the code where the parsing context may 
not be available, and there you won't be able to disambiguate,


Thanks RalfD
Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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