Here was the validation code that succeeded in Java 1.6
// parse an XML document into a DOM tree
try {
DocumentBuilder parser =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = parser.parse(new File("/booking.xml"));
// create a SchemaFactory capable of understanding WXS schemas
SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
// load a WXS schema, represented by a Schema instance
Source schemaFile = new StreamSource(new
File("/booking-scenario/xsd/lexs/publish-discover/3.1/publish-discover.xsd"));
Schema schema = factory.newSchema(schemaFile);
// create a Validator instance, which can be used to validate an
instance document
Validator validator = schema.newValidator();
// validate the DOM tree
validator.validate(new DOMSource(document));
} catch (Exception e) {
// instance document is invalid!
}
--
View this message in context:
http://www.nabble.com/Validation-Component-in-Java-1.6.10-tp20631074s22882p20631103.html
Sent from the Camel - Users mailing list archive at Nabble.com.