in src/main/java/org/apache/maven/plugins/changes/schema/DefaultChangesSchemaValidator.java [56:90]
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 = new XmlStreamReader( file ) )
{
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 );
}
}