Package net.sf.saxon.dom
Class DocumentBuilderFactoryImpl
java.lang.Object
javax.xml.parsers.DocumentBuilderFactory
net.sf.saxon.dom.DocumentBuilderFactoryImpl
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);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String name) Allows the user to retrieve specific attributes on the underlying implementation.boolean
getFeature
(String name) Get the state of the named feature.boolean
Get state of XInclude processing.Creates a new instance of aDocumentBuilder
using the currently configured parameters.void
setAttribute
(String name, Object value) Allows the user to set specific attributes on the underlying implementation.void
setFeature
(String name, boolean value) Set a feature for thisDocumentBuilderFactory
andDocumentBuilder
s created by this factory.void
setXIncludeAware
(boolean state) Set state of XInclude processing.Methods inherited from class javax.xml.parsers.DocumentBuilderFactory
getSchema, isCoalescing, isExpandEntityReferences, isIgnoringComments, isIgnoringElementContentWhitespace, isNamespaceAware, isValidating, newDefaultInstance, newDefaultNSInstance, newInstance, newInstance, newNSInstance, newNSInstance, setCoalescing, setExpandEntityReferences, setIgnoringComments, setIgnoringElementContentWhitespace, setNamespaceAware, setSchema, setValidating
-
Constructor Details
-
DocumentBuilderFactoryImpl
public DocumentBuilderFactoryImpl()
-
-
Method Details
-
setAttribute
Allows the user to set specific attributes on the underlying implementation.- Specified by:
setAttribute
in classDocumentBuilderFactory
- Parameters:
name
- The name of the attribute. For Saxon this must be one of the names defined inFeatureKeys
value
- The value of the attribute.- Throws:
IllegalArgumentException
- thrown if the underlying implementation doesn't recognize the attribute.
-
getAttribute
Allows the user to retrieve specific attributes on the underlying implementation.- Specified by:
getAttribute
in classDocumentBuilderFactory
- Parameters:
name
- The name of the attribute. For Saxon this must be one of the names defined inFeatureKeys
- Returns:
- value The value of the attribute.
- Throws:
IllegalArgumentException
- thrown if the underlying implementation doesn't recognize the attribute.
-
newDocumentBuilder
Creates a new instance of aDocumentBuilder
using the currently configured parameters.- Specified by:
newDocumentBuilder
in classDocumentBuilderFactory
- 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.
-
setFeature
Set a feature for this
Feature names are fully qualifiedDocumentBuilderFactory
andDocumentBuilder
s created by this factory.URI
s. Implementations may define their own features. AnParserConfigurationException
is thrown if thisDocumentBuilderFactory
or theDocumentBuilder
s it creates cannot support the feature. It is possible for anDocumentBuilderFactory
to expose a feature value but be unable to change its state. All implementations are required to support theXMLConstants.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 registeredErrorHandler.fatalError(org.xml.sax.SAXParseException exception)
. SeeDocumentBuilder.setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
. -
false
: the implementation will processing XML according to the XML specifications without regard to possible implementation limits.
- Specified by:
setFeature
in classDocumentBuilderFactory
- Parameters:
name
- Feature name.value
- Is feature statetrue
orfalse
.- Throws:
ParserConfigurationException
- if thisDocumentBuilderFactory
or theDocumentBuilder
s it creates cannot support this feature.NullPointerException
- If thename
parameter is null.
-
-
getFeature
Get the state of the named feature.
Feature names are fully qualifiedURI
s. Implementations may define their own features. AnParserConfigurationException
is thrown if thisDocumentBuilderFactory
or theDocumentBuilder
s it creates cannot support the feature. It is possible for anDocumentBuilderFactory
to expose a feature value but be unable to change its state.- Specified by:
getFeature
in classDocumentBuilderFactory
- Parameters:
name
- Feature name.- Returns:
- State of the named feature.
- Throws:
ParserConfigurationException
- if thisDocumentBuilderFactory
or theDocumentBuilder
s it creates cannot support this feature.
-
isXIncludeAware
public boolean isXIncludeAware()Get state of XInclude processing.
- Overrides:
isXIncludeAware
in classDocumentBuilderFactory
- 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
-
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
.- Overrides:
setXIncludeAware
in classDocumentBuilderFactory
- Parameters:
state
- Set XInclude processing totrue
orfalse
- Throws:
UnsupportedOperationException
- For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.- Since:
- 1.5
-