else {
schema = factory.newSchema();
}
// Setup validator and parser
ValidatorHandler validator = schema.newValidatorHandler();
parser.setContentHandler(validator);
if (validator instanceof DTDHandler) {
parser.setDTDHandler((DTDHandler) validator);
}
parser.setErrorHandler(writer);
validator.setContentHandler(writer);
validator.setErrorHandler(writer);
writer.setTypeInfoProvider(validator.getTypeInfoProvider());
try {
validator.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, schemaFullChecking);
}
catch (SAXNotRecognizedException e) {
System.err.println("warning: Validator does not recognize feature ("+SCHEMA_FULL_CHECKING_FEATURE_ID+")");
}
catch (SAXNotSupportedException e) {
System.err.println("warning: Validator does not support feature ("+SCHEMA_FULL_CHECKING_FEATURE_ID+")");
}
try {
validator.setFeature(HONOUR_ALL_SCHEMA_LOCATIONS_ID, honourAllSchemaLocations);
}
catch (SAXNotRecognizedException e) {
System.err.println("warning: Validator does not recognize feature ("+HONOUR_ALL_SCHEMA_LOCATIONS_ID+")");
}
catch (SAXNotSupportedException e) {
System.err.println("warning: Validator does not support feature ("+HONOUR_ALL_SCHEMA_LOCATIONS_ID+")");
}
try {
validator.setFeature(VALIDATE_ANNOTATIONS_ID, validateAnnotations);
}
catch (SAXNotRecognizedException e) {
System.err.println("warning: Validator does not recognize feature ("+VALIDATE_ANNOTATIONS_ID+")");
}
catch (SAXNotSupportedException e) {
System.err.println("warning: Validator does not support feature ("+VALIDATE_ANNOTATIONS_ID+")");
}
try {
validator.setFeature(GENERATE_SYNTHETIC_ANNOTATIONS_ID, generateSyntheticAnnotations);
}
catch (SAXNotRecognizedException e) {
System.err.println("warning: Validator does not recognize feature ("+GENERATE_SYNTHETIC_ANNOTATIONS_ID+")");
}
catch (SAXNotSupportedException e) {