Class SAXParserFactoryImpl

java.lang.Object
javax.xml.parsers.SAXParserFactory
org.apache.harmony.xml.parsers.SAXParserFactoryImpl

public class SAXParserFactoryImpl
extends SAXParserFactory
Provides a straightforward SAXParserFactory implementation based on Expat. The class is used internally only, thus only notable members that are not already in the abstract superclass are documented.
  • Constructor Details

    • SAXParserFactoryImpl

      public SAXParserFactoryImpl()
  • Method Details

    • getFeature

      public boolean getFeature​(String name) throws SAXNotRecognizedException
      Description copied from class: SAXParserFactory

      Returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.

      Specified by:
      getFeature in class SAXParserFactory
      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: SAXParserFactory
      Indicates whether or not the factory is configured to produce parsers which are namespace aware.
      Overrides:
      isNamespaceAware in class SAXParserFactory
      Returns:
      true if the factory is configured to produce parsers which are namespace aware; false otherwise.
    • isValidating

      public boolean isValidating()
      Description copied from class: SAXParserFactory
      Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.
      Overrides:
      isValidating in class SAXParserFactory
      Returns:
      true if the factory is configured to produce parsers which validate the XML content during parse; false otherwise.
    • newSAXParser

      public SAXParser newSAXParser() throws ParserConfigurationException
      Description copied from class: SAXParserFactory

      Creates a new instance of a SAXParser using the currently configured factory parameters.

      Specified by:
      newSAXParser in class SAXParserFactory
      Returns:
      A new instance of a SAXParser.
      Throws:
      ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.
    • setFeature

      public void setFeature​(String name, boolean value) throws SAXNotRecognizedException
      Description copied from class: 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.
      • When the feature is false, the implementation will processing XML according to the XML specifications without regard to possible implementation limits.
      Specified by:
      setFeature in class SAXParserFactory
      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: SAXParserFactory
      Specifies that the parser produced by this code will provide support for XML namespaces. By default the value of this is set to false.
      Overrides:
      setNamespaceAware in class SAXParserFactory
      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: SAXParserFactory
      Specifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set to 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.

      Overrides:
      setValidating in class SAXParserFactory
      Parameters:
      value - true if the parser produced by this code will validate documents as they are parsed; false otherwise.