Create a new SAXParser
try{
// Use reflection to avoid a build dependency with Xerces.
Class versionClass =
Class.forName("org.apache.xerces.impl.Version");
isXercesUsed = true;
} catch (Exception ex){
isXercesUsed = false;
}
if (isXercesUsed){
return XercesParser.newSAXParser(properties);
} else {
return GenericParser.newSAXParser(properties);
}