Validator validator = schema.newValidator();
try {
validator.validate(document.getDomSource());
} catch (IOException e) {
throw new ModelValidationException("Error during DOM document validation", e);
} catch (SAXException e) {
throw new ModelValidationException("DOM document is not valid", e);
}
}