Create a SAXParser
configured to support XML Scheman and DTD
SAXParserFactory factory =
(SAXParserFactory)properties.get("SAXParserFactory");
SAXParser parser = factory.newSAXParser();
String schemaLocation = (String)properties.get("schemaLocation");
String schemaLanguage = (String)properties.get("schemaLanguage");
try{
if (schemaLocation != null) {
parser.setProperty(JAXP_SCHEMA_LANGUAGE, schemaLanguage);
parser.setProperty(JAXP_SCHEMA_SOURCE, schemaLocation);
}
} catch (SAXNotRecognizedException e){
log.info(parser.getClass().getName() + ": "
+ e.getMessage() + " not supported.");
}
return parser;