Package net.sf.saxon.dom
Class DocumentBuilderFactoryImpl
- java.lang.Object
-
- javax.xml.parsers.DocumentBuilderFactory
-
- net.sf.saxon.dom.DocumentBuilderFactoryImpl
-
public class DocumentBuilderFactoryImpl extends javax.xml.parsers.DocumentBuilderFactoryImplementation 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 Constructor Description DocumentBuilderFactoryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetAttribute(java.lang.String name)Allows the user to retrieve specific attributes on the underlying implementation.booleangetFeature(java.lang.String name)Get the state of the named feature.booleanisXIncludeAware()Get state of XInclude processing.javax.xml.parsers.DocumentBuildernewDocumentBuilder()Creates a new instance of aDocumentBuilderusing the currently configured parameters.voidsetAttribute(java.lang.String name, java.lang.Object value)Allows the user to set specific attributes on the underlying implementation.voidsetFeature(java.lang.String name, boolean value)Set a feature for thisDocumentBuilderFactoryandDocumentBuilders created by this factory.voidsetXIncludeAware(boolean state)Set state of XInclude processing.-
Methods inherited from class javax.xml.parsers.DocumentBuilderFactory
getSchema, isCoalescing, isExpandEntityReferences, isIgnoringComments, isIgnoringElementContentWhitespace, isNamespaceAware, isValidating, newDefaultInstance, newInstance, newInstance, setCoalescing, setExpandEntityReferences, setIgnoringComments, setIgnoringElementContentWhitespace, setNamespaceAware, setSchema, setValidating
-
-
-
-
Method Detail
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)Allows the user to set specific attributes on the underlying implementation.- Specified by:
setAttributein classjavax.xml.parsers.DocumentBuilderFactory- Parameters:
name- The name of the attribute. For Saxon this must be one of the names defined inFeatureKeysvalue- The value of the 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)
Allows the user to retrieve specific attributes on the underlying implementation.- Specified by:
getAttributein classjavax.xml.parsers.DocumentBuilderFactory- 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:
java.lang.IllegalArgumentException- thrown if the underlying implementation doesn't recognize the attribute.
-
newDocumentBuilder
public javax.xml.parsers.DocumentBuilder newDocumentBuilder() throws javax.xml.parsers.ParserConfigurationExceptionCreates a new instance of aDocumentBuilderusing the currently configured parameters.- Specified by:
newDocumentBuilderin classjavax.xml.parsers.DocumentBuilderFactory- Returns:
- A new instance of a DocumentBuilder. For Saxon the returned DocumentBuilder
will be an instance of
DocumentBuilderImpl - Throws:
javax.xml.parsers.ParserConfigurationException- if a DocumentBuilder cannot be created which satisfies the configuration requested.
-
setFeature
public void setFeature(java.lang.String name, boolean value) throws javax.xml.parsers.ParserConfigurationExceptionSet a feature for this
Feature names are fully qualifiedDocumentBuilderFactoryandDocumentBuilders created by this factory.URIs. Implementations may define their own features. AnParserConfigurationExceptionis thrown if thisDocumentBuilderFactoryor theDocumentBuilders it creates cannot support the feature. It is possible for anDocumentBuilderFactoryto expose a feature value but be unable to change its state. All implementations are required to support theXMLConstants.FEATURE_SECURE_PROCESSINGfeature. 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:
setFeaturein classjavax.xml.parsers.DocumentBuilderFactory- Parameters:
name- Feature name.value- Is feature statetrueorfalse.- Throws:
javax.xml.parsers.ParserConfigurationException- if thisDocumentBuilderFactoryor theDocumentBuilders it creates cannot support this feature.java.lang.NullPointerException- If thenameparameter is null.
-
-
getFeature
public boolean getFeature(java.lang.String name) throws javax.xml.parsers.ParserConfigurationExceptionGet the state of the named feature.
Feature names are fully qualifiedURIs. Implementations may define their own features. AnParserConfigurationExceptionis thrown if thisDocumentBuilderFactoryor theDocumentBuilders it creates cannot support the feature. It is possible for anDocumentBuilderFactoryto expose a feature value but be unable to change its state.- Specified by:
getFeaturein classjavax.xml.parsers.DocumentBuilderFactory- Parameters:
name- Feature name.- Returns:
- State of the named feature.
- Throws:
javax.xml.parsers.ParserConfigurationException- if thisDocumentBuilderFactoryor theDocumentBuilders it creates cannot support this feature.
-
isXIncludeAware
public boolean isXIncludeAware()
Get state of XInclude processing.
- Overrides:
isXIncludeAwarein classjavax.xml.parsers.DocumentBuilderFactory- Returns:
- current state of XInclude processing
- Throws:
java.lang.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:
setXIncludeAwarein classjavax.xml.parsers.DocumentBuilderFactory- Parameters:
state- Set XInclude processing totrueorfalse- Throws:
java.lang.UnsupportedOperationException- For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.- Since:
- 1.5
-
-