List Info

Thread: ctxt->sax->fatalError never beging used




ctxt->sax->fatalError never beging used
user name
2006-07-28 09:13:18
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;

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'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.

Thanks,

-- Petr
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
ctxt->sax->fatalError never beging used
user name
2006-07-28 09:23:20
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/
veillardredhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )