DocumentBuilder
abstract class DocumentBuilder
kotlin.Any | |
↳ | javax.xml.parsers.DocumentBuilder |
Defines the API to obtain DOM Document instances from an XML document. Using this class, an application programmer can obtain a Document
from XML.
An instance of this class can be obtained from the DocumentBuilderFactory.newDocumentBuilder()
method. Once an instance of this class is obtained, XML can be parsed from a variety of input sources. These input sources are InputStreams, Files, URLs, and SAX InputSources.
Note that this class reuses several classes from the SAX API. This does not require that the implementor of the underlying DOM implementation use a SAX parser to parse XML document into a Document
. It merely requires that the implementation communicate with the application using these existing APIs.
Summary
Protected constructors | |
---|---|
Protected constructor |
Public methods | |
---|---|
abstract DOMImplementation! |
Obtain an instance of a |
open Schema! |
Get a reference to the the |
abstract Boolean |
Indicates whether or not this parser is configured to understand namespaces. |
abstract Boolean |
Indicates whether or not this parser is configured to validate XML documents. |
open Boolean |
Get the XInclude processing mode for this parser. |
abstract Document! |
Obtain a new instance of a DOM |
open Document! |
Parse the content of the given file as an XML document and return a new DOM |
open Document! |
parse(is: InputStream!) Parse the content of the given |
open Document! |
parse(is: InputStream!, systemId: String!) Parse the content of the given |
open Document! |
Parse the content of the given URI as an XML document and return a new DOM |
abstract Document! |
parse(is: InputSource!) Parse the content of the given input source as an XML document and return a new DOM |
open Unit |
reset() Reset this |
abstract Unit |
Specify the |
abstract Unit |
setErrorHandler(eh: ErrorHandler!) Specify the |
Protected constructors
Public methods
getDOMImplementation
abstract fun getDOMImplementation(): DOMImplementation!
Obtain an instance of a DOMImplementation
object.
Return | |
---|---|
DOMImplementation! |
A new instance of a DOMImplementation . |
getSchema
open fun getSchema(): Schema!
Get a reference to the the Schema
being used by the XML processor.
If no schema is being used, null
is returned.
Return | |
---|---|
Schema! |
Schema being used or null if none in use |
Exceptions | |
---|---|
java.lang.UnsupportedOperationException |
For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown. |
isNamespaceAware
abstract fun isNamespaceAware(): Boolean
Indicates whether or not this parser is configured to understand namespaces.
Return | |
---|---|
Boolean |
true if this parser is configured to understand namespaces; false otherwise. |
isValidating
abstract fun isValidating(): Boolean
Indicates whether or not this parser is configured to validate XML documents.
Return | |
---|---|
Boolean |
true if this parser is configured to validate XML documents; false otherwise. |
isXIncludeAware
open fun isXIncludeAware(): Boolean
Get the XInclude processing mode for this parser.
Return | |
---|---|
Boolean |
the return value of the DocumentBuilderFactory.isXIncludeAware() when this parser was created from factory. |
Exceptions | |
---|---|
java.lang.UnsupportedOperationException |
For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown. |
newDocument
abstract fun newDocument(): Document!
Obtain a new instance of a DOM Document
object to build a DOM tree with.
Return | |
---|---|
Document! |
A new instance of a DOM Document object. |
parse
open fun parse(f: File!): Document!
Parse the content of the given file as an XML document and return a new DOM Document
object. An IllegalArgumentException
is thrown if the File
is null
null.
Parameters | |
---|---|
f |
File!: The file containing the XML to parse. |
Return | |
---|---|
Document! |
A new DOM Document object. |
Exceptions | |
---|---|
java.io.IOException |
If any IO errors occur. |
org.xml.sax.SAXException |
If any parse errors occur. |
See Also
parse
open fun parse(is: InputStream!): Document!
Parse the content of the given InputStream
as an XML document and return a new DOM Document
object. An IllegalArgumentException
is thrown if the InputStream
is null.
Parameters | |
---|---|
is |
InputStream!: InputStream containing the content to be parsed. |
Return | |
---|---|
Document! |
Document result of parsing the InputStream |
Exceptions | |
---|---|
java.io.IOException |
If any IO errors occur. |
org.xml.sax.SAXException |
If any parse errors occur. |
See Also
parse
open fun parse(
is: InputStream!,
systemId: String!
): Document!
Parse the content of the given InputStream
as an XML document and return a new DOM Document
object. An IllegalArgumentException
is thrown if the InputStream
is null.
Parameters | |
---|---|
is |
InputStream!: InputStream containing the content to be parsed. |
systemId |
String!: Provide a base for resolving relative URIs. |
Return | |
---|---|
Document! |
A new DOM Document object. |
Exceptions | |
---|---|
java.io.IOException |
If any IO errors occur. |
org.xml.sax.SAXException |
If any parse errors occur. |
See Also
parse
open fun parse(uri: String!): Document!
Parse the content of the given URI as an XML document and return a new DOM Document
object. An IllegalArgumentException
is thrown if the URI is null
null.
Parameters | |
---|---|
uri |
String!: The location of the content to be parsed. |
Return | |
---|---|
Document! |
A new DOM Document object. |
Exceptions | |
---|---|
java.io.IOException |
If any IO errors occur. |
org.xml.sax.SAXException |
If any parse errors occur. |
See Also
parse
abstract fun parse(is: InputSource!): Document!
Parse the content of the given input source as an XML document and return a new DOM Document
object. An IllegalArgumentException
is thrown if the InputSource
is null
null.
Parameters | |
---|---|
is |
InputSource!: InputSource containing the content to be parsed. |
Return | |
---|---|
Document! |
A new DOM Document object. |
Exceptions | |
---|---|
java.io.IOException |
If any IO errors occur. |
org.xml.sax.SAXException |
If any parse errors occur. |
See Also
reset
open fun reset(): Unit
Reset this DocumentBuilder
.
EntityResolver
and ErrorHandler
instances associated with this DocumentBuilder
and sets all internal properties to false including those set by the DocumentBuilderFactory
when this DocumentBuilder
was created.
setEntityResolver
abstract fun setEntityResolver(er: EntityResolver!): Unit
Specify the EntityResolver
to be used to resolve entities present in the XML document to be parsed. Setting this to null
will result in the underlying implementation using it's own default implementation and behavior.
Parameters | |
---|---|
er |
EntityResolver!: The EntityResolver to be used to resolve entities present in the XML document to be parsed. |
setErrorHandler
abstract fun setErrorHandler(eh: ErrorHandler!): Unit
Specify the ErrorHandler
to be used by the parser. Setting this to null
will result in the underlying implementation using it's own default implementation and behavior.
Parameters | |
---|---|
eh |
ErrorHandler!: The ErrorHandler to be used by the parser. |