commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [Digester] Validating a XML schema problem
Date Tue, 02 Mar 2004 02:09:16 GMT
Quoting robert burrell donkin <robertburrelldonkin@blueyonder.co.uk>:

> On 1 Mar 2004, at 20:17, Simon Kitching wrote:
> 
> <snip>
> 
> >> From a quick glance at the code, it looks like Digester registers 
> >> itself
> > as an org.xml.sax.ErrorHandler (it extends
> > org.xml.sax.helpers.DefaultHandler), and that by default it ignores all
> > sax errors:
> >
> >     public void error(SAXParseException exception) throws SAXException 
> > {
> >
> >         log.error("Parse Error at line " + exception.getLineNumber() +
> >                 " column " + exception.getColumnNumber() + ": " +
> >                 exception.getMessage(), exception);
> >         if (errorHandler != null) {
> >             errorHandler.error(exception);
> >         }
> >
> >     }
> 
> yep
> 
> > Craig/Robert: why does Digester ignore sax errors by default?
> 
> (if i was being pendantic, i'd say that strictly speaking digester 
> doesn't ignore them so much as only log them ;)
> 
> craig would be the one to give a definite answer on this one but here 
> how i see it:
> 
> the default behaviour for SAX parsers is to ignore errors. digester 
> simply extends this behaviour to provide better diagnostics.

That was pretty much the original reasoning.  At the end of the day, Digester is
just a pretty face around a SAX parse.

> i do agree 
> that it's a more than a little unintuitive. maybe we could provide a 
> boolean flag to allow the user to select the behaviour they want.
> 

Well, we actually went one better than that by letting you register your own
ErrorHandler to which Digester will delegate.  Now you can do anything you
want.

> - robert

Craig


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message