public SchemaParsingConfig(SymbolTable symbolTable,
XMLGrammarPool grammarPool,
XMLComponentManager parentSettings) {
super(symbolTable, parentSettings);
// add default recognized features
final String[] recognizedFeatures = {
PARSER_SETTINGS, WARN_ON_DUPLICATE_ATTDEF, WARN_ON_UNDECLARED_ELEMDEF,
ALLOW_JAVA_ENCODINGS, CONTINUE_AFTER_FATAL_ERROR,
LOAD_EXTERNAL_DTD, NOTIFY_BUILTIN_REFS,
NOTIFY_CHAR_REFS, GENERATE_SYNTHETIC_ANNOTATIONS
};
addRecognizedFeatures(recognizedFeatures);
fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
// set state for default features
fFeatures.put(WARN_ON_DUPLICATE_ATTDEF, Boolean.FALSE);
//setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);
fFeatures.put(WARN_ON_UNDECLARED_ELEMDEF, Boolean.FALSE);
fFeatures.put(ALLOW_JAVA_ENCODINGS, Boolean.FALSE);
fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE);
fFeatures.put(NOTIFY_BUILTIN_REFS, Boolean.FALSE);
fFeatures.put(NOTIFY_CHAR_REFS, Boolean.FALSE);
fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
// add default recognized properties
final String[] recognizedProperties = {
ERROR_REPORTER,
ENTITY_MANAGER,
DOCUMENT_SCANNER,
DTD_SCANNER,
DTD_VALIDATOR,
NAMESPACE_BINDER,
XMLGRAMMAR_POOL,
DATATYPE_VALIDATOR_FACTORY,
VALIDATION_MANAGER,
GENERATE_SYNTHETIC_ANNOTATIONS
};
addRecognizedProperties(recognizedProperties);
fGrammarPool = grammarPool;
if (fGrammarPool != null) {
setProperty(XMLGRAMMAR_POOL, fGrammarPool);
}
fEntityManager = new XMLEntityManager();
fProperties.put(ENTITY_MANAGER, fEntityManager);
addComponent(fEntityManager);
fErrorReporter = new XMLErrorReporter();
fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner());
fProperties.put(ERROR_REPORTER, fErrorReporter);
addComponent(fErrorReporter);
fNamespaceScanner = new XMLNSDocumentScannerImpl();
fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
addRecognizedParamsAndSetDefaults(fNamespaceScanner);
fDTDScanner = new XMLDTDScannerImpl();
fProperties.put(DTD_SCANNER, fDTDScanner);
addRecognizedParamsAndSetDefaults(fDTDScanner);
fDatatypeValidatorFactory = DTDDVFactory.getInstance();
fProperties.put(DATATYPE_VALIDATOR_FACTORY,
fDatatypeValidatorFactory);
fValidationManager = new ValidationManager();
fProperties.put(VALIDATION_MANAGER, fValidationManager);
fVersionDetector = new XMLVersionDetector();
// add message formatters
if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
XMLMessageFormatter xmft = new XMLMessageFormatter();
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
}
if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
XSMessageFormatter xmft = new XSMessageFormatter();
fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, xmft);
}
// set locale
try {
setLocale(Locale.getDefault());
}
catch (XNIException e) {
// do nothing
// REVISIT: What is the right thing to do? -Ac
}
}
Parameters:
symbolTable - The symbol table to use.
grammarPool - The grammar pool to use.
parentSettings - The parent settings.
|