commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: Digester: No rules found matching
Date Sat, 05 Jun 2004 02:11:38 GMT
On Sat, 2004-06-05 at 14:05, Steve Fischer wrote:
> Simon- 
> Thanks very much for your synchronistic response.


>    I have since 
> resorted to using XML Schema. 
> I did not have any luck with the properties declared in the Digester 
> class (probably my ignorance), so I used the following instead:
>     Digester digester = new Digester();
>     digester.setValidating(true);
>     digester.setNamespaceAware(true);
>     digester.setSchemaLanguage("");
>     digester.setSchema("wdkModelSchema.xsd");
>     digester.setErrorHandler(new org.xml.sax.helpers.DefaultHandler());
> Unfortunately, the DefaultHandler does not offer the option of 
> terminating on error (instead it logs [ERROR] messages).
> So, I am now in search of an ErrorHandler that does that.

You should just create a subclass of ErrorHandler. It's really trivial
to write. Each of the methods "warning", "error", "fatalError" just need
to be:
  // throw the parameter as an exception
  throw exception;

I suggest writing it as a static inner class, or even an anonymous
class, if you are only creating the digester in one place.



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

View raw message