And parser attributes and not parser properties features
114 Chapter 3 • Processing XML Documents with DOM
Note that the servlet’s doGet() method uses this instance using a synchronized() block:
synchronized(this)
{
myParser.parseNow(xmlstream);
returnValue = myParser.returnResult();
}Since the DocumentBuilderFactory class in itself is not thread-safe, the code may behave erratically or exceptions/errors may be thrown.
www.syngress.com
public void setFeature(String name, boolean value) throws
SAXNotRecognizedException, SAXNotSupportedException
If the parser cannot recognize a feature, the SAXNotRecognizedException is thrown. If the parser is not equipped to support the feature, a
SAXNotSupportedException is thrown.SAX parsers do not have any of the properties required. However, the XMLReader interface provides two methods, setProperty() and getProperty(),to set and to retrieve the parser properties:
For example, to set the schema location for elements that are not in any namespace of http://www.propertyexample.com/schema.xsd, the following code may be used:
parserObject.setProperty(http://apache.org/xml/properties/schema +