use of org.apache.xerces.util.ShadowedSymbolTable in project iaf by ibissource.
the class MyErrorHandler method createValidatingParser.
public XMLReader createValidatingParser(IPipeLineSession session, ValidationContext context) throws XmlValidatorException, ConfigurationException, PipeRunException {
SymbolTable symbolTable = ((XercesValidationContext) context).getSymbolTable();
XMLGrammarPool grammarPool = ((XercesValidationContext) context).getGrammarPool();
XMLReader parser = new SAXParser(new ShadowedSymbolTable(symbolTable), grammarPool);
try {
parser.setFeature(NAMESPACES_FEATURE_ID, true);
parser.setFeature(VALIDATION_FEATURE_ID, true);
// parser.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); // this feature is not recognized
// parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE_ID, false); // this one appears to be not working
// parser.setFeature(EXTERNAL_PARAMETER_ENTITIES_FEATURE_ID, false);
// parser.setFeature(DISSALLOW_DOCTYPE_DECL_FEATURE_ID, true);
parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
parser.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, isFullSchemaChecking());
parser.setErrorHandler(context.getErrorHandler());
org.apache.xerces.util.SecurityManager mgr = new org.apache.xerces.util.SecurityManager();
mgr.setEntityExpansionLimit(entityExpansionLimit);
parser.setProperty(SECURITY_MANAGER_PROPERTY_ID, mgr);
} catch (SAXNotRecognizedException e) {
throw new XmlValidatorException(logPrefix + "parser does not recognize necessary feature", e);
} catch (SAXNotSupportedException e) {
throw new XmlValidatorException(logPrefix + "parser does not support necessary feature", e);
}
return parser;
}
Aggregations