public class SAXParserFactoryImpl extends SAXParserFactory
Constructor and Description |
---|
SAXParserFactoryImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
getFeature(String name)
Returns the particular property requested for in the underlying
implementation of org.xml.sax.XMLReader.
|
boolean |
isNamespaceAware()
Indicates whether or not the factory is configured to produce
parsers which are namespace aware.
|
boolean |
isValidating()
Indicates whether or not the factory is configured to produce
parsers which validate the XML content during parse.
|
SAXParser |
newSAXParser()
Creates a new instance of a SAXParser using the currently
configured factory parameters.
|
void |
setFeature(String name,
boolean value)
Sets the particular feature in the underlying implementation of
org.xml.sax.XMLReader.
|
void |
setNamespaceAware(boolean value)
Specifies that the parser produced by this code will
provide support for XML namespaces.
|
void |
setValidating(boolean value)
Specifies that the parser produced by this code will
validate documents as they are parsed.
|
getSchema, isXIncludeAware, newInstance, newInstance, setSchema, setXIncludeAware
public boolean getFeature(String name) throws SAXNotRecognizedException
SAXParserFactory
Returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.
getFeature
in class SAXParserFactory
name
- The name of the property to be retrieved.SAXNotRecognizedException
- When the underlying XMLReader does not recognize the property name.XMLReader.getProperty(java.lang.String)
public boolean isNamespaceAware()
SAXParserFactory
isNamespaceAware
in class SAXParserFactory
public boolean isValidating()
SAXParserFactory
isValidating
in class SAXParserFactory
public SAXParser newSAXParser() throws ParserConfigurationException
SAXParserFactory
Creates a new instance of a SAXParser using the currently configured factory parameters.
newSAXParser
in class SAXParserFactory
ParserConfigurationException
- if a parser cannot
be created which satisfies the requested configuration.public void setFeature(String name, boolean value) throws SAXNotRecognizedException
SAXParserFactory
Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader. A list of the core features and properties can be found at http://www.saxproject.org/
All implementations are required to support the XMLConstants.FEATURE_SECURE_PROCESSING
feature.
When the feature is
true
: the implementation will limit XML processing to conform to implementation limits.
Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
If XML processing is limited for security reasons, it will be reported via a call to the registered
ErrorHandler.fatalError(SAXParseException exception)
.
See SAXParser
parse
methods for handler specification.
false
, the implementation will processing XML according to the XML specifications without
regard to possible implementation limits.
setFeature
in class SAXParserFactory
name
- The name of the feature to be set.value
- The value of the feature to be set.SAXNotRecognizedException
- When the underlying XMLReader does
not recognize the property name.XMLReader.setFeature(java.lang.String, boolean)
public void setNamespaceAware(boolean value)
SAXParserFactory
false
.setNamespaceAware
in class SAXParserFactory
value
- true if the parser produced by this code will
provide support for XML namespaces; false otherwise.public void setValidating(boolean value)
SAXParserFactory
false
.
Note that "the validation" here means a validating parser as defined in the XML recommendation. In other words, it essentially just controls the DTD validation. (except the legacy two properties defined in JAXP 1.2. See here for more details.)
To use modern schema languages such as W3C XML Schema or
RELAX NG instead of DTD, you can configure your parser to be
a non-validating parser by leaving the SAXParserFactory.setValidating(boolean)
method false, then use the SAXParserFactory.setSchema(Schema)
method to associate a schema to a parser.
setValidating
in class SAXParserFactory
value
- true if the parser produced by this code will
validate documents as they are parsed; false otherwise.