net.sf.saxon.dom

Class DocumentBuilderFactoryImpl

public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory

Implementation of JAXP 1.1 DocumentBuilderFactory. To build a Document using Saxon, set the system property javax.xml.parsers.DocumentBuilderFactory to "net.sf.saxon.om.DocumentBuilderFactoryImpl" and then call DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(InputSource);
Field Summary
Configurationconfig
booleanxIncludeAware
Constructor Summary
DocumentBuilderFactoryImpl()
Method Summary
ObjectgetAttribute(String name)
Allows the user to retrieve specific attributes on the underlying implementation.
booleangetFeature(String name)

Get the state of the named feature.

Feature names are fully qualified java.net.URIs.

booleanisXIncludeAware()

Get state of XInclude processing.

DocumentBuildernewDocumentBuilder()
Creates a new instance of a javax.xml.parsers.DocumentBuilder using the currently configured parameters.
voidsetAttribute(String name, Object value)
Allows the user to set specific attributes on the underlying implementation.
voidsetFeature(String name, boolean value)

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

Feature names are fully qualified java.net.URIs.

voidsetXIncludeAware(boolean state)

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.

Field Detail

config

Configuration config

xIncludeAware

boolean xIncludeAware

Constructor Detail

DocumentBuilderFactoryImpl

public DocumentBuilderFactoryImpl()

Method Detail

getAttribute

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

Parameters: name The name of the attribute. For Saxon this must be one of the names defined in FeatureKeys

Returns: value The value of the attribute.

Throws: IllegalArgumentException thrown if the underlying implementation doesn't recognize the attribute.

getFeature

public boolean getFeature(String name)

Get the state of the named feature.

Feature names are fully qualified java.net.URIs. Implementations may define their own features. An javax.xml.parsers.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.

Parameters: name Feature name.

Returns: State of the named feature.

Throws: javax.xml.parsers.ParserConfigurationException if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support this feature.

isXIncludeAware

public boolean isXIncludeAware()

Get state of XInclude processing.

Returns: current state of XInclude processing

Throws: UnsupportedOperationException For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.

Since: 1.5

newDocumentBuilder

public DocumentBuilder newDocumentBuilder()
Creates a new instance of a javax.xml.parsers.DocumentBuilder using the currently configured parameters.

Returns: A new instance of a DocumentBuilder. For Saxon the returned DocumentBuilder will be an instance of DocumentBuilderImpl

Throws: ParserConfigurationException if a DocumentBuilder cannot be created which satisfies the configuration requested.

setAttribute

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

Parameters: name The name of the attribute. For Saxon this must be one of the names defined in FeatureKeys value The value of the attribute.

Throws: IllegalArgumentException thrown if the underlying implementation doesn't recognize the attribute.

setFeature

public void setFeature(String name, boolean value)

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

Feature names are fully qualified java.net.URIs. Implementations may define their own features. An javax.xml.parsers.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 javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING feature. When the feature is:

Parameters: name Feature name. value Is feature state true or false.

Throws: javax.xml.parsers.ParserConfigurationException if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support this feature. NullPointerException If the name parameter is null.

setXIncludeAware

public void setXIncludeAware(boolean state)

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.

Parameters: state Set XInclude processing to true or false

Throws: UnsupportedOperationException For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.

Since: 1.5