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

Re: [xml] ctxt->sax->fatalError never beging used



On Fri, Jul 28, 2006 at 11:13:18AM +0200, Petr Pajas wrote:
> Hi Daniel, All,
> 
> I wonder why the sax fatalError callback is never called even for fatal 
> errors. I would assume the corresponding code in __xmlRaiseError to look 
> something like:
> 
> if (level == XML_ERR_WARNING)
>             channel = ctxt->sax->warning;
>         else if (level == XML_ERR_FATAL)
>             channel = ctxt->sax->fatalError;
>         else
>             channel = ctxt->sax->error;

  Hum, if ctxt->sax->fatalError is NULL one would need to fallback to
ctxt->sax->error.

> while it currently only looks like:
> 
> if (level == XML_ERR_WARNING)
>             channel = ctxt->sax->warning;
>         else
>             channel = ctxt->sax->error;
> 
> Is there an intention in this?

  I guess it's historical, we never called it, all errors from the parser
are fatal, only later on non-fatal errors were added (e.g. namespace 
errors), and it was kind of too late.

> I'm asking because we map these callbacks to Perl-level SAX callbacks in the 
> Perl XML::LibXML SAX binding. I need fatalError Perl callback to be called on 
> a fatal error in order to be consistent with other SAX-based parser 
> interfaces in Perl.

  Best is to register a structured error handler in the SAX block (assuming
SAXv2 see the serror callback) so you get all informations.

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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