InputSource in = ValidationDriver.uriOrFileInputSource(schema.getAbsolutePath());
PropertyMapBuilder properties = new PropertyMapBuilder();
ByteArrayOutputStream error = new ByteArrayOutputStream();
ErrorHandlerImpl eh = new ErrorHandlerImpl(new BufferedWriter(new OutputStreamWriter(error)));
ValidateProperty.ERROR_HANDLER.put(properties, eh);
SchemaReader schemaReader = new AutoSchemaReader();
ValidationDriver driver = new ValidationDriver(properties.toPropertyMap(), schemaReader);
if (driver.loadSchema(in)) {
if (driver.validate(ValidationDriver.uriOrFileInputSource(xml.getAbsolutePath()))) {
System.out.println("" + error);
return null;