Thursday, June 04, 2009

Digester, validation and XSD

How to validate XML using XSD in Digester (1.8 version)? There is no clear answer in Digester documentation.
Here you can see how to validate XML using XSD:

File xsdFile = new File(${location});
Digester digester = new Digester();
digester.setValidating(true);
digester.setNamespaceAware(true);
digester.setErrorHandler(myErrorHandler); // Don't forget to set custom error handler
digester.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
digester.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", xsdFile); // You can use File, String, InputStream, InputSource or an array of these type
digester.parse(...);

3 comments:

Jay Khimani said...
This comment has been removed by the author.
Anonymous said...

free car facts vin
winter emergency kit for the car
advantage car hire
car maxford mustangs
lambskin car coat
amman car rental
vigilance for driver in car
three wheel car auto

Anonymous said...

If you are ever in search of a iphone unlock that is easy to use and efficiently unlock your iphone, then there are models of unlocking tools such as unlock 3g iphone in the online websites available on the world wide web.
________________
[url=http://www.unlock-iphone.org]unlock iphone 3g[/url]