Class SAXParserFactoryImpl
public class SAXParserFactoryImpl extends SAXParserFactory
-
Constructor Summary
Constructors Constructor Description SAXParserFactoryImpl() -
Method Summary
Modifier and Type Method Description booleangetFeature(String name)Returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.booleanisNamespaceAware()Indicates whether or not the factory is configured to produce parsers which are namespace aware.booleanisValidating()Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.SAXParsernewSAXParser()Creates a new instance of a SAXParser using the currently configured factory parameters.voidsetFeature(String name, boolean value)Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.voidsetNamespaceAware(boolean value)Specifies that the parser produced by this code will provide support for XML namespaces.voidsetValidating(boolean value)Specifies that the parser produced by this code will validate documents as they are parsed.Methods inherited from class javax.xml.parsers.SAXParserFactory
getSchema, isXIncludeAware, newInstance, newInstance, setSchema, setXIncludeAware
-
Constructor Details
-
SAXParserFactoryImpl
public SAXParserFactoryImpl()
-
-
Method Details
-
getFeature
Description copied from class:SAXParserFactoryReturns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.
- Specified by:
getFeaturein classSAXParserFactory- Parameters:
name- The name of the property to be retrieved.- Returns:
- Value of the requested property.
- Throws:
SAXNotRecognizedException- When the underlying XMLReader does not recognize the property name.- See Also:
XMLReader.getProperty(java.lang.String)
-
isNamespaceAware
public boolean isNamespaceAware()Description copied from class:SAXParserFactoryIndicates whether or not the factory is configured to produce parsers which are namespace aware.- Overrides:
isNamespaceAwarein classSAXParserFactory- Returns:
- true if the factory is configured to produce parsers which are namespace aware; false otherwise.
-
isValidating
public boolean isValidating()Description copied from class:SAXParserFactoryIndicates whether or not the factory is configured to produce parsers which validate the XML content during parse.- Overrides:
isValidatingin classSAXParserFactory- Returns:
- true if the factory is configured to produce parsers which validate the XML content during parse; false otherwise.
-
newSAXParser
Description copied from class:SAXParserFactoryCreates a new instance of a SAXParser using the currently configured factory parameters.
- Specified by:
newSAXParserin classSAXParserFactory- Returns:
- A new instance of a SAXParser.
- Throws:
ParserConfigurationException- if a parser cannot be created which satisfies the requested configuration.
-
setFeature
Description copied from class:SAXParserFactorySets 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_PROCESSINGfeature. 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 registeredErrorHandler.fatalError(SAXParseException exception). SeeSAXParserparsemethods for handler specification. -
When the feature is
false, the implementation will processing XML according to the XML specifications without regard to possible implementation limits.
- Specified by:
setFeaturein classSAXParserFactory- Parameters:
name- The name of the feature to be set.value- The value of the feature to be set.- Throws:
SAXNotRecognizedException- When the underlying XMLReader does not recognize the property name.- See Also:
XMLReader.setFeature(java.lang.String, boolean)
-
-
setNamespaceAware
public void setNamespaceAware(boolean value)Description copied from class:SAXParserFactorySpecifies that the parser produced by this code will provide support for XML namespaces. By default the value of this is set tofalse.- Overrides:
setNamespaceAwarein classSAXParserFactory- Parameters:
value- true if the parser produced by this code will provide support for XML namespaces; false otherwise.
-
setValidating
public void setValidating(boolean value)Description copied from class:SAXParserFactorySpecifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set tofalse.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 theSAXParserFactory.setSchema(Schema)method to associate a schema to a parser.- Overrides:
setValidatingin classSAXParserFactory- Parameters:
value- true if the parser produced by this code will validate documents as they are parsed; false otherwise.
-