org.apache.xerces.jaxp

## Class SAXParserFactoryImpl

- java.lang.Object
- - javax.xml.parsers.SAXParserFactory
  - - org.apache.xerces.jaxp.SAXParserFactoryImpl

-     public class SAXParserFactoryImpl
      extends javax.xml.parsers.SAXParserFactory

  This is the implementation specific class for the `javax.xml.parsers.SAXParserFactory`. This is the platform default implementation for the platform.
  Version:
    $Id: SAXParserFactoryImpl.java 447237 2006-09-18 05:03:10Z mrglavas $
  Author:
    Rajiv Mordani, Edwin Goei

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SAXParserFactoryImpl()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `getFeature(java.lang.String name)` returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.
    `javax.xml.validation.Schema` | `getSchema()` Gets the `Schema` object specified through the `SAXParserFactory.setSchema(Schema schema)` method.
    `boolean` | `isXIncludeAware()` Get state of XInclude processing.
    `javax.xml.parsers.SAXParser` | `newSAXParser()` Creates a new instance of `SAXParser` using the currently configured factory parameters.
    `void` | `setFeature(java.lang.String name, boolean value)` Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.
    `void` | `setSchema(javax.xml.validation.Schema grammar)` Set the `Schema` to be used by parsers created from this factory.
    `void` | `setXIncludeAware(boolean state)` Set state of XInclude processing.

    - ### Methods inherited from class javax.xml.parsers.SAXParserFactory

      `isNamespaceAware, isValidating, newInstance, newInstance, setNamespaceAware, setValidating`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SAXParserFactoryImpl

          public SAXParserFactoryImpl()

  - ### Method Detail

    - #### newSAXParser

          public javax.xml.parsers.SAXParser newSAXParser()
                                                   throws javax.xml.parsers.ParserConfigurationException

      Creates a new instance of `SAXParser` using the currently configured factory parameters.
      Specified by:
        `newSAXParser` in class `javax.xml.parsers.SAXParserFactory`
      Returns:
        javax.xml.parsers.SAXParser
      Throws:
        `javax.xml.parsers.ParserConfigurationException` - if a parser cannot be created which satisfies the requested configuration.

    - #### setFeature

          public void setFeature(java.lang.String name,
                        boolean value)
                          throws javax.xml.parsers.ParserConfigurationException,
                                 org.xml.sax.SAXNotRecognizedException,
                                 org.xml.sax.SAXNotSupportedException

      Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.
      Specified by:
        `setFeature` in class `javax.xml.parsers.SAXParserFactory`
      Parameters:
        `name` - The name of the feature to be set.
        `value` - The value of the feature to be set.
      Throws:
        `javax.xml.parsers.ParserConfigurationException` - if a parser cannot be created which satisfies the requested configuration.
        `org.xml.sax.SAXNotRecognizedException` - When the underlying XMLReader does not recognize the property name.
        `org.xml.sax.SAXNotSupportedException` - When the underlying XMLReader recognizes the property name but doesn't support the property.
      See Also:
        `XMLReader.setFeature(java.lang.String, boolean)`

    - #### getFeature

          public boolean getFeature(java.lang.String name)
                             throws javax.xml.parsers.ParserConfigurationException,
                                    org.xml.sax.SAXNotRecognizedException,
                                    org.xml.sax.SAXNotSupportedException

      returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.
      Specified by:
        `getFeature` in class `javax.xml.parsers.SAXParserFactory`
      Parameters:
        `name` - The name of the property to be retrieved.
      Returns:
        Value of the requested property.
      Throws:
        `javax.xml.parsers.ParserConfigurationException` - if a parser cannot be created which satisfies the requested configuration.
        `org.xml.sax.SAXNotRecognizedException` - When the underlying XMLReader does not recognize the property name.
        `org.xml.sax.SAXNotSupportedException` - When the underlying XMLReader recognizes the property name but doesn't support the property.
      See Also:
        `XMLReader.getProperty(java.lang.String)`

    - #### getSchema

          public javax.xml.validation.Schema getSchema()

      Description copied from class: `javax.xml.parsers.SAXParserFactory`
      Gets the `Schema` object specified through the `SAXParserFactory.setSchema(Schema schema)` method.
      Overrides:
        `getSchema` in class `javax.xml.parsers.SAXParserFactory`
      Returns:
        the `Schema` object that was last set through the `SAXParserFactory.setSchema(Schema)` method, or null if the method was not invoked since a `SAXParserFactory` is created.

    - #### setSchema

          public void setSchema(javax.xml.validation.Schema grammar)

      Description copied from class: `javax.xml.parsers.SAXParserFactory`

      Set the `Schema` to be used by parsers created from this factory.

      When a `Schema` is non-null, a parser will use a validator created from it to validate documents before it passes information down to the application.

      When warnings/errors/fatal errors are found by the validator, the parser must handle them as if those errors were found by the parser itself. In other words, if the user-specified `ErrorHandler` is set, it must receive those errors, and if not, they must be treated according to the implementation specific default error handling rules.

      A validator may modify the SAX event stream (for example by adding default values that were missing in documents), and a parser is responsible to make sure that the application will receive those modified event stream.

      Initially, `null` is set as the `Schema`.

      This processing will take effect even if the `SAXParserFactory.isValidating()` method returns `false`.

      It is an error to use the `http://java.sun.com/xml/jaxp/properties/schemaSource` property and/or the `http://java.sun.com/xml/jaxp/properties/schemaLanguage` property in conjunction with a non-null `Schema` object. Such configuration will cause a `SAXException` exception when those properties are set on a `SAXParser`.

      #### Note for implementors

      A parser must be able to work with any `Schema` implementation. However, parsers and schemas are allowed to use implementation-specific custom mechanisms as long as they yield the result described in the specification.

      Overrides:
        `setSchema` in class `javax.xml.parsers.SAXParserFactory`
      Parameters:
        `grammar` - `Schema` to use, `null` to remove a schema.

    - #### isXIncludeAware

          public boolean isXIncludeAware()

      Description copied from class: `javax.xml.parsers.SAXParserFactory`

      Get state of XInclude processing.

      Overrides:
        `isXIncludeAware` in class `javax.xml.parsers.SAXParserFactory`
      Returns:
        current state of XInclude processing

    - #### setXIncludeAware

          public void setXIncludeAware(boolean state)

      Description copied from class: `javax.xml.parsers.SAXParserFactory`

      Set state of XInclude processing.

      If XInclude markup is found in the document instance, should it be processed as specified in XML Inclusions (XInclude) Version 1.0.

      XInclude processing defaults to `false`.

      Overrides:
        `setXIncludeAware` in class `javax.xml.parsers.SAXParserFactory`
      Parameters:
        `state` - Set XInclude processing to `true` or `false`

Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.