in src/main/java/org/apache/maven/plugins/changes/schema/DefaultChangesSchemaValidator.java [54:79]
public XmlValidationHandler validateXmlWithSchema(File file, String schemaVersion, boolean failOnValidationError)
throws SchemaValidatorException {
try {
String schemaPath = CHANGES_SCHEMA_PATH + "changes-" + schemaVersion + ".xsd";
Schema schema = getSchema(schemaPath);
Validator validator = schema.newValidator();
XmlValidationHandler baseHandler = new XmlValidationHandler(failOnValidationError);
validator.setErrorHandler(baseHandler);
try (Reader reader = XmlStreamReader.builder().setFile(file).get()) {
validator.validate(new StreamSource(reader));
}
return baseHandler;
} catch (IOException e) {
throw new SchemaValidatorException("IOException : " + e.getMessage(), e);
} catch (SAXException e) {
throw new SchemaValidatorException("SAXException : " + e.getMessage(), e);
} catch (Exception e) {
throw new SchemaValidatorException("Exception : " + e.getMessage(), e);
}
}