schema = factory.newSchema(url);
} catch (SAXException e) {
log.trace("Leaving validate");
throw new RuntimeException(e);
}
Validator validator = schema.newValidator();
StringReader reader = new StringReader(xml);
Source source = new StreamSource(reader);
SchemaValidationResult result = null;
try {
validator.validate(source);
result = new SchemaValidationResult(true, "The xml is valid.");
} catch (SAXException ex) {
result = new SchemaValidationResult(false, ex.getMessage());
log.debug("Validation: " + result);
log.debug("Cause: " + result.getMessage());