public class ConcurrentSAXParserFactory extends SAXParserFactory
This class serves as an alternative to the SAXParserFactory
that is provided by the JRE and provides the
following benefits: 1) The static newSAXParser()
method does not suffer from the performance problem of
obtaining parser implementations from the classpath, and 2) Since newSAXParser()
can be called without
performance concerns, multi-threaded environments (like web applications and portlets) can feel free to call the
method as much as required in each request, in order to maintain thread-safety. The drawback is that the SAXParserImpl
class does not fully implement all of the functionality of the one provided by the JRE.
For more information about the performance issues of the implementation provided by the JRE, see Reuse parser instances with the Xerces2 SAX and DOM implementations.
Modifier | Constructor and Description |
---|---|
protected |
ConcurrentSAXParserFactory() |
Modifier and Type | Method and Description |
---|---|
boolean |
getFeature(String name) |
static SAXParserFactory |
newInstance() |
SAXParser |
newSAXParser() |
void |
setFeature(String name,
boolean value) |
getSchema, isNamespaceAware, isValidating, isXIncludeAware, newInstance, setNamespaceAware, setSchema, setValidating, setXIncludeAware
public static SAXParserFactory newInstance()
public boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException
getFeature
in class SAXParserFactory
ParserConfigurationException
SAXNotRecognizedException
SAXNotSupportedException
public SAXParser newSAXParser() throws ParserConfigurationException, SAXException
newSAXParser
in class SAXParserFactory
ParserConfigurationException
SAXException
public void setFeature(String name, boolean value) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException
setFeature
in class SAXParserFactory
ParserConfigurationException
SAXNotRecognizedException
SAXNotSupportedException
Copyright © 2018 Liferay, Inc.. All rights reserved.