public void setFeature(String name,
boolean value) throws SAXNotSupportedException, SAXNotRecognizedException, ParserConfigurationException {
if (name == null) {
throw new NullPointerException();
}
// If this is the secure processing feature, save it then return.
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
fSecureProcess = value;
return;
}
// Keep built-in settings in synch with the feature values.
else if (name.equals(NAMESPACES_FEATURE)) {
setNamespaceAware(value);
return;
}
else if (name.equals(VALIDATION_FEATURE)) {
setValidating(value);
return;
}
else if (name.equals(XINCLUDE_FEATURE)) {
setXIncludeAware(value);
return;
}
// XXX This is ugly. We have to collect the features and then
// later create an XMLReader to verify the features.
if (features == null) {
features = new Hashtable();
}
features.put(name, value ? Boolean.TRUE : Boolean.FALSE);
// Test the feature by possibly throwing SAX exceptions
try {
newSAXParserImpl();
}
catch (SAXNotSupportedException e) {
features.remove(name);
throw e;
}
catch (SAXNotRecognizedException e) {
features.remove(name);
throw e;
}
}
Sets the particular feature in the underlying implementation of
org.xml.sax.XMLReader. |