You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Elliotte Rusty Harold <el...@metalab.unc.edu> on 2002/07/22 21:32:37 UTC
Default ErrorHandler
I've noticed with the latest Xerces 2.0.2 that it seems to be using its
own ErrorHandler when I'm parsing a document with SAX, which gets in the
way of SAX's own ErrorHandler. In particular:
1. Non-fatal errors are printed on System.err
2. If I pass null to parser.setErrorHandler(), I get
NullPointerExceptions when an error is reported
3. When I try to throw a custom subclass of SAXParseException out of the
ErrorHandler.error() method, a different exception gets thrown instead.
In other words, it feels that Xerces is being overly aggressive and
going beyond what the SAX spec says it will do. Two questions:
1. is this deliberate? Doe sit sound familair to anyone? Or have I
perhaps misdiagnosed the source of my problem?
2. Is there any way to turn off this unasked for behavior so I can
handle my own errors the way I need to?
--
Elliotte
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Re: Default ErrorHandler
Posted by Andy Clark <an...@apache.org>.
Elliotte Rusty Harold wrote:
> 1. Non-fatal errors are printed on System.err
That's the default behavior that we chose after years of
people reporting "bugs" saying that Xerces wasn't validating
their documents because they didn't see any errors on the
output. Now all of those bugs reports and the time required
to correct their misconceptions have gone away. :)
> 2. If I pass null to parser.setErrorHandler(), I get
> NullPointerExceptions when an error is reported
That should be corrected.
> 3. When I try to throw a custom subclass of SAXParseException out of the
> ErrorHandler.error() method, a different exception gets thrown instead.
This should be fixable as well.
> 2. Is there any way to turn off this unasked for behavior so I can
> handle my own errors the way I need to?
You can certainly avoid the error output performed by
the default installed error handler by registering a
no-op error handler of your own. The other problems are
probably due to SAX handling initiated from XNI events.
So SAX errors get wrapped by XNI errors. But this should
be fixable.
Anybody with free time to look into this?
--
Andy Clark * andyc@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org