org.apache.xerces.jaxp
Class SAXParserFactoryImpl

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

public class SAXParserFactoryImpl
extends 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
SAXParserFactoryImpl()
           
 
Method Summary
 boolean getFeature(java.lang.String name)
          returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.
 Schema getSchema()
          Gets the Schema object specified through the SAXParserFactory.setSchema(Schema schema) method.
 boolean isXIncludeAware()
          Get state of XInclude processing.
 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(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, setNamespaceAware, setValidating
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXParserFactoryImpl

public SAXParserFactoryImpl()
Method Detail

newSAXParser

public SAXParser newSAXParser()
                       throws ParserConfigurationException
Creates a new instance of SAXParser using the currently configured factory parameters.

Specified by:
newSAXParser in class SAXParserFactory
Returns:
javax.xml.parsers.SAXParser
Throws:
ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws ParserConfigurationException,
                       SAXNotRecognizedException,
                       SAXNotSupportedException
Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.

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:
ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.
SAXNotRecognizedException - When the underlying XMLReader does not recognize the property name.
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 ParserConfigurationException,
                          SAXNotRecognizedException,
                          SAXNotSupportedException
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:
ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.
SAXNotRecognizedException - When the underlying XMLReader does not recognize the property name.
SAXNotSupportedException - When the underlying XMLReader recognizes the property name but doesn't support the property.
See Also:
XMLReader.getProperty(java.lang.String)

getSchema

public Schema getSchema()
Description copied from class: SAXParserFactory
Gets the Schema object specified through the SAXParserFactory.setSchema(Schema schema) method.

Overrides:
getSchema in class 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(Schema grammar)
Description copied from class: 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.

Initialy, 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 implmentors

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 SAXParserFactory
Parameters:
grammar - Schema to use, null to remove a schema.

isXIncludeAware

public boolean isXIncludeAware()
Description copied from class: SAXParserFactory

Get state of XInclude processing.

Overrides:
isXIncludeAware in class SAXParserFactory
Returns:
current state of XInclude processing

setXIncludeAware

public void setXIncludeAware(boolean state)
Description copied from class: 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 SAXParserFactory
Parameters:
state - Set XInclude processing to true or false