org.apache.xerces.jaxp
Class DocumentBuilderFactoryImpl

java.lang.Object
  extended by javax.xml.parsers.DocumentBuilderFactory
      extended by org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

public class DocumentBuilderFactoryImpl
extends DocumentBuilderFactory

Version:
$Id: DocumentBuilderFactoryImpl.java 447237 2006-09-18 05:03:10Z mrglavas $
Author:
Rajiv Mordani, Edwin Goei

Constructor Summary
DocumentBuilderFactoryImpl()
           
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          Allows the user to retrieve specific attributes on the underlying implementation.
 boolean getFeature(java.lang.String name)
          Get the state of the named feature.
 Schema getSchema()
          Gets the Schema object specified through the DocumentBuilderFactory.setSchema(Schema schema) method.
 boolean isXIncludeAware()
          Get state of XInclude processing.
 DocumentBuilder newDocumentBuilder()
          Creates a new instance of a DocumentBuilder using the currently configured parameters.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Allows the user to set specific attributes on the underlying implementation.
 void setFeature(java.lang.String name, boolean value)
          Set a feature for this DocumentBuilderFactory and DocumentBuilders created by this factory.
 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.DocumentBuilderFactory
isCoalescing, isExpandEntityReferences, isIgnoringComments, isIgnoringElementContentWhitespace, isNamespaceAware, isValidating, newInstance, setCoalescing, setExpandEntityReferences, setIgnoringComments, setIgnoringElementContentWhitespace, setNamespaceAware, setValidating
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentBuilderFactoryImpl

public DocumentBuilderFactoryImpl()
Method Detail

newDocumentBuilder

public DocumentBuilder newDocumentBuilder()
                                   throws ParserConfigurationException
Creates a new instance of a DocumentBuilder using the currently configured parameters.

Specified by:
newDocumentBuilder in class DocumentBuilderFactory
Returns:
A new instance of a DocumentBuilder.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
                  throws java.lang.IllegalArgumentException
Allows the user to set specific attributes on the underlying implementation.

Specified by:
setAttribute in class DocumentBuilderFactory
Parameters:
name - name of attribute
value - null means to remove attribute
Throws:
java.lang.IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
                              throws java.lang.IllegalArgumentException
Allows the user to retrieve specific attributes on the underlying implementation.

Specified by:
getAttribute in class DocumentBuilderFactory
Parameters:
name - The name of the attribute.
Returns:
value The value of the attribute.
Throws:
java.lang.IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.

getSchema

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

Overrides:
getSchema in class DocumentBuilderFactory
Returns:
the Schema object that was last set through the DocumentBuilderFactory.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: DocumentBuilderFactory

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 errors are found by the validator, the parser is responsible to report them to the user-specified DOMErrorHandler (or if the error handler is not set, ignore them or throw them), just like any other errors found by the parser itself. In other words, if the user-specified DOMErrorHandler 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 outcome of a parse (for example by adding default values that were missing in documents), and a parser is responsible to make sure that the application will receive modified DOM trees.

Initialy, null is set as the Schema.

This processing will take effect even if the DocumentBuilderFactory.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 Schema object. Such configuration will cause a ParserConfigurationException exception when the DocumentBuilderFactory.newDocumentBuilder() is invoked.

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

isXIncludeAware

public boolean isXIncludeAware()
Description copied from class: DocumentBuilderFactory

Get state of XInclude processing.

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

setXIncludeAware

public void setXIncludeAware(boolean state)
Description copied from class: DocumentBuilderFactory

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 DocumentBuilderFactory
Parameters:
state - Set XInclude processing to true or false

getFeature

public boolean getFeature(java.lang.String name)
                   throws ParserConfigurationException
Description copied from class: DocumentBuilderFactory

Get the state of the named feature.

Feature names are fully qualified URIs. Implementations may define their own features. An ParserConfigurationException is thrown if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support the feature. It is possible for an DocumentBuilderFactory to expose a feature value but be unable to change its state.

Specified by:
getFeature in class DocumentBuilderFactory
Parameters:
name - Feature name.
Returns:
State of the named feature.
Throws:
ParserConfigurationException - if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support this feature.

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws ParserConfigurationException
Description copied from class: DocumentBuilderFactory

Set a feature for this DocumentBuilderFactory and DocumentBuilders created by this factory.

Feature names are fully qualified URIs. Implementations may define their own features. An ParserConfigurationException is thrown if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support the feature. It is possible for an DocumentBuilderFactory to expose a feature value but be unable to change its state.

All implementations are required to support the XMLConstants.FEATURE_SECURE_PROCESSING feature. When the feature is:

Specified by:
setFeature in class DocumentBuilderFactory
Parameters:
name - Feature name.
value - Is feature state true or false.
Throws:
ParserConfigurationException - if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support this feature.