// passed to SAX handlers.
//
if (suffixLength == Constants.STRING_INTERNING_FEATURE.length() &&
featureId.endsWith(Constants.STRING_INTERNING_FEATURE)) {
if (!state) {
throw new SAXNotSupportedException(
SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
"false-not-supported", new Object [] {featureId}));
}
return;
}
// http://xml.org/sax/features/lexical-handler/parameter-entities
// controls whether the beginning and end of parameter entities
// will be reported to the LexicalHandler.
//
if (suffixLength == Constants.LEXICAL_HANDLER_PARAMETER_ENTITIES_FEATURE.length() &&
featureId.endsWith(Constants.LEXICAL_HANDLER_PARAMETER_ENTITIES_FEATURE)) {
fLexicalHandlerParameterEntities = state;
return;
}
// http://xml.org/sax/features/resolve-dtd-uris
// controls whether system identifiers will be absolutized relative to
// their base URIs before reporting.
//
if (suffixLength == Constants.RESOLVE_DTD_URIS_FEATURE.length() &&
featureId.endsWith(Constants.RESOLVE_DTD_URIS_FEATURE)) {
fResolveDTDURIs = state;
return;
}
// http://xml.org/sax/features/unicode-normalization-checking
// controls whether Unicode normalization checking is performed
// as per Appendix B of the XML 1.1 specification
//
if (suffixLength == Constants.UNICODE_NORMALIZATION_CHECKING_FEATURE.length() &&
featureId.endsWith(Constants.UNICODE_NORMALIZATION_CHECKING_FEATURE)) {
// REVISIT: Allow this feature to be set once Unicode normalization
// checking is supported -- mrglavas.
if (state) {
throw new SAXNotSupportedException(
SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
"true-not-supported", new Object [] {featureId}));
}
return;
}
// http://xml.org/sax/features/xmlns-uris
// controls whether the parser reports that namespace declaration
// attributes as being in the namespace: http://www.w3.org/2000/xmlns/
//
if (suffixLength == Constants.XMLNS_URIS_FEATURE.length() &&
featureId.endsWith(Constants.XMLNS_URIS_FEATURE)) {
fXMLNSURIs = state;
return;
}
// http://xml.org/sax/features/use-entity-resolver2
// controls whether the methods of an object implementing
// org.xml.sax.ext.EntityResolver2 will be used by the parser.
//
if (suffixLength == Constants.USE_ENTITY_RESOLVER2_FEATURE.length() &&
featureId.endsWith(Constants.USE_ENTITY_RESOLVER2_FEATURE)) {
if (state != fUseEntityResolver2) {
fUseEntityResolver2 = state;
// Refresh EntityResolver wrapper.
setEntityResolver(getEntityResolver());
}
return;
}
//
// Read only features.
//
// http://xml.org/sax/features/is-standalone
// reports whether the document specified a standalone document declaration.
// http://xml.org/sax/features/use-attributes2
// reports whether Attributes objects passed to startElement also implement
// the org.xml.sax.ext.Attributes2 interface.
// http://xml.org/sax/features/use-locator2
// reports whether Locator objects passed to setDocumentLocator also implement
// the org.xml.sax.ext.Locator2 interface.
// http://xml.org/sax/features/xml-1.1
// reports whether the parser supports both XML 1.1 and XML 1.0.
if ((suffixLength == Constants.IS_STANDALONE_FEATURE.length() &&
featureId.endsWith(Constants.IS_STANDALONE_FEATURE)) ||
(suffixLength == Constants.USE_ATTRIBUTES2_FEATURE.length() &&
featureId.endsWith(Constants.USE_ATTRIBUTES2_FEATURE)) ||
(suffixLength == Constants.USE_LOCATOR2_FEATURE.length() &&
featureId.endsWith(Constants.USE_LOCATOR2_FEATURE)) ||
(suffixLength == Constants.XML_11_FEATURE.length() &&
featureId.endsWith(Constants.XML_11_FEATURE))) {
throw new SAXNotSupportedException(
SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
"feature-read-only", new Object [] {featureId}));
}
//
// Drop through and perform default processing
//
}
//
// Xerces Features
//
/*
else if (featureId.startsWith(XERCES_FEATURES_PREFIX)) {
String feature = featureId.substring(XERCES_FEATURES_PREFIX.length());
//
// Drop through and perform default processing
//
}
*/
//
// Default handling
//
fConfiguration.setFeature(featureId, state);
}
catch (XMLConfigurationException e) {
String identifier = e.getIdentifier();
if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
throw new SAXNotRecognizedException(
SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
"feature-not-recognized", new Object [] {identifier}));
}
else {
throw new SAXNotSupportedException(
SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
"feature-not-supported", new Object [] {identifier}));
}
}