commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: [Digester] Error handler not working
Date Sun, 02 Jul 2006 22:18:37 GMT
Hi Frank,

On Fri, 2006-06-30 at 15:33 -0400, Frank W. Zammetti wrote:
> Hello... I'm parsing some XML that I am validating against a DTD... I'd
> like to be able to stop processing when that validation fails, and I
> thought setErrorHandler() would do it, but seemingly not... I have a class
> that, with three methods:
> public void error(SAXParseException exception)
> public void fatalError(SAXParseException exception)
> public void warning(SAXParseException exception)
> I register it with my Digester instance (before parsing begins) via
> setErrorHandler().
> I just did a simple exception.printStackTrace() (as well as some println's
> to be sure) in each method, and it turns out they are not getting called. 
> However, I can see in my logs a SEVERE message stating where the
> validation failed from Digester, so it IS validating as expected.
> Should this work this way?  Does the error handler you register via
> setErrorHandler() not handle DTD validation failures maybe?  Maybe only
> parsing errors? (I would expect them to be handled the same, but maybe
> not)  Anything else I'm missing?  Thanks!

Sorry, don't have an answer for you. However I would expect that DTD
validation failures would be reported to the error handler you
registered; as far as I know DTD failures are reported through the same
error handler used for other problems.

The Digester instance is registered as the ErrorHandler for the sax
parser, and it does this:

 public void error(SAXParseException exception) throws SAXException {
   log.error("Parse Error at line " + exception.getLineNumber() +
           " column " + exception.getColumnNumber() + ": " +
           exception.getMessage(), exception);
   if (errorHandler != null) {

What exactly is the log message you are getting?



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message