Fields Summary |
---|
private static final String | SCHEMA_VALIDATIONFeature identifier: schema validation. |
private static final String | VALIDATIONFeature identifier: validation. |
private static final String | USE_GRAMMAR_POOL_ONLYFeature identifier: use grammar pool only. |
protected static final String | IGNORE_XSI_TYPEFeature identifier: whether to ignore xsi:type attributes until a global element declaration is encountered |
protected static final String | ID_IDREF_CHECKINGFeature identifier: whether to ignore ID/IDREF errors |
protected static final String | UNPARSED_ENTITY_CHECKINGFeature identifier: whether to ignore unparsed entity errors |
protected static final String | IDENTITY_CONSTRAINT_CHECKINGFeature identifier: whether to ignore identity constraint errors |
private static final String | ENTITY_MANAGERProperty identifier: entity manager. |
private static final String | ENTITY_RESOLVERProperty identifier: entity resolver. |
private static final String | ERROR_HANDLERProperty identifier: error handler. |
private static final String | ERROR_REPORTERProperty identifier: error reporter. |
private static final String | NAMESPACE_CONTEXTProperty identifier: namespace context. |
private static final String | SCHEMA_VALIDATORProperty identifier: XML Schema validator. |
private static final String | SECURITY_MANAGERProperty identifier: security manager. |
private static final String | SYMBOL_TABLEProperty identifier: symbol table. |
private static final String | VALIDATION_MANAGERProperty identifier: validation manager. |
private static final String | XMLGRAMMAR_POOLProperty identifier: grammar pool. |
private boolean | fConfigUpdatedfConfigUpdated is set to true if there has been any change to the configuration settings,
i.e a feature or a property was changed. |
private boolean | fUseGrammarPoolOnlyTracks whether the validator should use components from
the grammar pool to the exclusion of all others. |
private final HashMap | fComponentsLookup map for components required for validation. |
private org.apache.xerces.impl.XMLEntityManager | fEntityManagerEntity manager. |
private org.apache.xerces.impl.XMLErrorReporter | fErrorReporterError reporter. |
private org.apache.xerces.xni.NamespaceContext | fNamespaceContextNamespace context. |
private org.apache.xerces.impl.xs.XMLSchemaValidator | fSchemaValidatorXML Schema validator. |
private org.apache.xerces.impl.validation.ValidationManager | fValidationManagerValidation manager. |
private HashMap | fInitFeaturesStores initial feature values for validator reset. |
private HashMap | fInitPropertiesStores initial property values for validator reset. |
private org.apache.xerces.util.SecurityManager | fInitSecurityManagerStores the initial security manager. |
private ErrorHandler | fErrorHandlerApplication's ErrorHandler. |
private LSResourceResolver | fResourceResolverApplication's LSResourceResolver. |
Methods Summary |
---|
public void | addRecognizedParamsAndSetDefaults(org.apache.xerces.xni.parser.XMLComponent component, XSGrammarPoolContainer grammarContainer)Adds all of the component's recognized features and properties
to the list of default recognized features and properties, and
sets default values on the configuration for features and
properties which were previously absent from the configuration.
// register component's recognized features
final String[] recognizedFeatures = component.getRecognizedFeatures();
addRecognizedFeatures(recognizedFeatures);
// register component's recognized properties
final String[] recognizedProperties = component.getRecognizedProperties();
addRecognizedProperties(recognizedProperties);
// set default values
setFeatureDefaults(component, recognizedFeatures, grammarContainer);
setPropertyDefaults(component, recognizedProperties);
|
org.xml.sax.ErrorHandler | getErrorHandler()
return fErrorHandler;
|
public boolean | getFeature(java.lang.String featureId)Returns the state of a feature.
if (PARSER_SETTINGS.equals(featureId)) {
return fConfigUpdated;
}
else if (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId)) {
return true;
}
else if (USE_GRAMMAR_POOL_ONLY.equals(featureId)) {
return fUseGrammarPoolOnly;
}
else if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
return getProperty(SECURITY_MANAGER) != null;
}
return super.getFeature(featureId);
|
public java.lang.Object | getProperty(java.lang.String propertyId)Returns the value of a property.
final Object component = fComponents.get(propertyId);
if (component != null) {
return component;
}
else if (fComponents.containsKey(propertyId)) {
return null;
}
return super.getProperty(propertyId);
|
public org.w3c.dom.ls.LSResourceResolver | getResourceResolver()
return fResourceResolver;
|
public void | reset()Calls reset on each of the components owned by this component manager.
fNamespaceContext.reset();
fValidationManager.reset();
fEntityManager.reset(this);
fErrorReporter.reset(this);
fSchemaValidator.reset(this);
// Mark configuration as fixed.
fConfigUpdated = false;
|
void | restoreInitialState()Cleans out configuration, restoring it to its initial state.
fConfigUpdated = true;
// Remove error resolver and error handler
fComponents.put(ENTITY_RESOLVER, null);
fComponents.put(ERROR_HANDLER, null);
// Restore initial security manager
fComponents.put(SECURITY_MANAGER, fInitSecurityManager);
// Reset feature and property values to their initial values
if (!fInitFeatures.isEmpty()) {
Iterator iter = fInitFeatures.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
boolean value = ((Boolean) entry.getValue()).booleanValue();
super.setFeature(name, value);
}
fInitFeatures.clear();
}
if (!fInitProperties.isEmpty()) {
Iterator iter = fInitProperties.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
Object value = entry.getValue();
super.setProperty(name, value);
}
fInitProperties.clear();
}
|
void | setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
fErrorHandler = errorHandler;
setProperty(ERROR_HANDLER, (errorHandler != null) ? new ErrorHandlerWrapper(errorHandler) :
new ErrorHandlerWrapper(DraconianErrorHandler.getInstance()));
|
public void | setFeature(java.lang.String featureId, boolean value)Set the state of a feature.
if (PARSER_SETTINGS.equals(featureId)) {
throw new XMLConfigurationException(XMLConfigurationException.NOT_SUPPORTED, featureId);
}
else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
throw new XMLConfigurationException(XMLConfigurationException.NOT_SUPPORTED, featureId);
}
else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
throw new XMLConfigurationException(XMLConfigurationException.NOT_SUPPORTED, featureId);
}
if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
setProperty(SECURITY_MANAGER, value ? new SecurityManager() : null);
return;
}
fConfigUpdated = true;
fEntityManager.setFeature(featureId, value);
fErrorReporter.setFeature(featureId, value);
fSchemaValidator.setFeature(featureId, value);
if (!fInitFeatures.containsKey(featureId)) {
boolean current = super.getFeature(featureId);
fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
}
super.setFeature(featureId, value);
|
private void | setFeatureDefaults(org.apache.xerces.xni.parser.XMLComponent component, java.lang.String[] recognizedFeatures, XSGrammarPoolContainer grammarContainer)Sets feature defaults for the given component on this configuration.
if (recognizedFeatures != null) {
for (int i = 0; i < recognizedFeatures.length; ++i) {
String featureId = recognizedFeatures[i];
Boolean state = grammarContainer.getFeature(featureId);
if (state == null) {
state = component.getFeatureDefault(featureId);
}
if (state != null) {
// Do not overwrite values already set on the configuration.
if (!fFeatures.containsKey(featureId)) {
fFeatures.put(featureId, state);
// For newly added components who recognize this feature
// but did not offer a default value, we need to make
// sure these components will get an opportunity to read
// the value before parsing begins.
fConfigUpdated = true;
}
}
}
}
|
public void | setProperty(java.lang.String propertyId, java.lang.Object value)Sets the state of a property.
if ( ENTITY_MANAGER.equals(propertyId) || ERROR_REPORTER.equals(propertyId) ||
NAMESPACE_CONTEXT.equals(propertyId) || SCHEMA_VALIDATOR.equals(propertyId) ||
SYMBOL_TABLE.equals(propertyId) || VALIDATION_MANAGER.equals(propertyId) ||
XMLGRAMMAR_POOL.equals(propertyId)) {
throw new XMLConfigurationException(XMLConfigurationException.NOT_SUPPORTED, propertyId);
}
fConfigUpdated = true;
fEntityManager.setProperty(propertyId, value);
fErrorReporter.setProperty(propertyId, value);
fSchemaValidator.setProperty(propertyId, value);
if (ENTITY_RESOLVER.equals(propertyId) || ERROR_HANDLER.equals(propertyId) ||
SECURITY_MANAGER.equals(propertyId)) {
fComponents.put(propertyId, value);
return;
}
if (!fInitProperties.containsKey(propertyId)) {
fInitProperties.put(propertyId, super.getProperty(propertyId));
}
super.setProperty(propertyId, value);
|
private void | setPropertyDefaults(org.apache.xerces.xni.parser.XMLComponent component, java.lang.String[] recognizedProperties)Sets property defaults for the given component on this configuration.
if (recognizedProperties != null) {
for (int i = 0; i < recognizedProperties.length; ++i) {
String propertyId = recognizedProperties[i];
Object value = component.getPropertyDefault(propertyId);
if (value != null) {
// Do not overwrite values already set on the configuration.
if (!fProperties.containsKey(propertyId)) {
fProperties.put(propertyId, value);
// For newly added components who recognize this property
// but did not offer a default value, we need to make
// sure these components will get an opportunity to read
// the value before parsing begins.
fConfigUpdated = true;
}
}
}
}
|
void | setResourceResolver(org.w3c.dom.ls.LSResourceResolver resourceResolver)
fResourceResolver = resourceResolver;
setProperty(ENTITY_RESOLVER, new DOMEntityResolverWrapper(resourceResolver));
|