net.sf.saxon.dom
public class DocumentBuilderImpl extends DocumentBuilder
Method Summary | |
---|---|
Configuration | getConfiguration()
Get the Saxon Configuration to be used by the document builder. |
DOMImplementation | getDOMImplementation()
Obtain an instance of a DOMImplementation object.
|
int | getStripSpace()
Get the space-stripping action to be applied to the source document |
boolean | isNamespaceAware()
Indicates whether or not this document builder is configured to
understand namespaces.
|
boolean | isValidating()
Indicates whether or not this document builder is configured to
validate XML documents against a DTD.
|
boolean | isXIncludeAware() Get the XInclude processing mode for this parser. |
Document | newDocument()
Create a new Document Node. |
Document | parse(InputSource in)
Parse the content of the given input source as an XML document
and return a new DOM Document object.
|
Document | parse(File f)
Parse the content of the given file as an XML document
and return a new DOM Document object.
|
void | setConfiguration(Configuration config)
Set the Saxon Configuration to be used by the document builder.
|
void | setEntityResolver(EntityResolver er)
Specify the EntityResolver to be used to resolve
entities present in the XML document to be parsed. |
void | setErrorHandler(ErrorHandler eh)
Specify the ErrorHandler to be used by the parser.
|
void | setStripSpace(int stripAction)
Set the space-stripping action to be applied to the source document |
void | setValidating(boolean state)
Determine whether the document builder should perform DTD validation |
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 |
Returns: the Configuration previously supplied to DocumentBuilderImpl, or the Configuration created automatically by Saxon on the first call to the DocumentBuilderImpl method, or null if no Configuration has been supplied and the DocumentBuilderImpl method has not been called.
Since: Saxon 8.8
Returns: A new instance of a DOMImplementation
.
Returns: one of IGNORABLE, ALL, or NONE
Since: 8.9
Returns: true if this document builder is configured to understand namespaces. This implementation always returns true.
Returns: true if this parser is configured to validate XML documents against a DTD; false otherwise.
Get the XInclude processing mode for this parser.
Returns: the return value of the javax.xml.parsers.DocumentBuilderFactory#isXIncludeAware() when this parser was created from factory.
Throws: UnsupportedOperationException For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since: JAXP 1.5, Saxon 8.9
See Also: javax.xml.parsers.DocumentBuilderFactory#setXIncludeAware(boolean)
Throws: UnsupportedOperationException (always). The only way to build a document using this DocumentBuilder implementation is by using the parse() method.
Note: for this document to be usable as part of a Saxon query or transformation, the document should be built within the Configuration in which that query or transformation is running. This can be achieved using the non-JAXP DocumentBuilderImpl method.
Parameters: in InputSource containing the content to be parsed. Note that if an EntityResolver or ErrorHandler has been supplied, then the XMLReader contained in this InputSource will be modified to register this EntityResolver or ErrorHandler, replacing any that was previously registered.
Returns: A new DOM Document object.
Throws: SAXException If any parse errors occur.
IllegalArgumentException
is thrown if the
File
is null
null.
This implementation differs from the parent implementation by using a correct algorithm for filename-to-uri conversion.
Parameters: f The file containing the XML to parse.
Returns: A new DOM Document object.
Throws: java.io.IOException If any IO errors occur. SAXException If any parse errors occur.
As an alternative to calling this method, a Configuration can be supplied by calling
setAttribute(FeatureKeys.CONFIGURATION, config)
on the DocumentBuilderFactory
object, where config
can be obtained by calling
getAttribute(FeatureKeys.CONFIGURATION)
on the TransformerFactory
.
Since: Saxon 8.8
null
will result in the underlying
implementation using the EntityResolver registered with the
XMLReader contained in the InputSource.
Parameters: er The EntityResolver
to be used to resolve entities
present in the XML document to be parsed.
null
will result in the underlying
implementation using using the ErrorHandler registered with the
XMLReader contained in the InputSource.
Parameters: eh The ErrorHandler
to be used by the parser.
Parameters: stripAction one of IGNORABLE, ALL, or NONE
Since: 8.9
Parameters: state set to true to request DTD validation
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