javax.xml.parsers
public
abstract
class
javax.xml.parsers.DocumentBuilder
Defines a bridge from XML sources (files, stream etc.) to DOM trees. Can be
used for easily obtaining a Document for the input. The class itself is
abstract. The class DocumentBuilderFactory is able to provide instances (of
concrete subclasses known to the system).
Summary
Protected Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Protected Constructors
protected
DocumentBuilder()
Do-nothing constructor. Prevents instantiation. To be overridden by
concrete subclasses.
Public Methods
public
abstract
DOMImplementation
getDOMImplementation()
Queries the DOM implementation this DocumentBuilder is working on.
public
abstract
boolean
isNamespaceAware()
Queries whether the DocumentBuilder has namespaces enabled.
Returns
- true if namespaces are turned on, false otherwise.
public
abstract
boolean
isValidating()
Queries whether the DocumentBuilder has validating enabled.
Returns
- true if validating is turned on, false otherwise.
public
boolean
isXIncludeAware()
Queries whether the DocumentBuilder has XInclude support enabled.
Returns
- true if XInclude support is turned on, false otherwise.
public
abstract
Document
newDocument()
Creates a new document, serving as the starting point for a DOM tree.
Parses a given XML input stream and builds a DOM tree from it.
Parameters
stream
| The stream to be parsed. |
Returns
- The document element that represents the root of the DOM tree.
Parses an XML input stream from a given URI and builds a DOM tree from
it.
Parameters
uri
| The URI to fetch the XML stream from. |
Returns
- The document element that represents the root of the DOM tree.
Parses a given XML file and builds a DOM tree from it.
Parameters
file
| The file to be parsed. |
Returns
- The document element that represents the root of the DOM tree.
Parses an XML input source and builds a DOM tree from it.
Parameters
source
| The input source to parse. |
Returns
- The document element that represents the root of the DOM tree.
Parses a given XML input stream and builds a DOM tree from it.
Parameters
stream
| The stream to be parsed. |
systemId
| The base for resolving relative URIs. |
Returns
- The document element that represents the root of the DOM tree.
public
void
reset()
Resets the DocumentBuilder to the same state is was in after its
creation.
public
abstract
void
setEntityResolver(EntityResolver resolver)
Sets the EntityResolver used for resolving entities encountered during
the parse process. Passing null results in the DocumentBuilder's own
EntityResolver being used.
Parameters
resolver
| The EntityResolver to use, or null for the built-in one.
|
public
abstract
void
setErrorHandler(ErrorHandler handler)
Sets the ErrorHandler used for dealing with errors encountered during the
parse process. Passing null results in the DocumentBuilder's own
ErrorHandler being used.
Parameters
handler
| The ErrorHandler to use, or null for the built-in one.
|