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("http://www.w3.org/2001/XMLSchema");
> 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.
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]