Overview | Package | Class | Tree | Deprecated | Index | Help
| Xerces 1.2.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.xml.parsers
Class DocumentBuilder

    java.lang.Object
      |
      +--javax.xml.parsers.DocumentBuilder

public abstract class DocumentBuilder
extends java.lang.Object

Instances of `DocumentBuilder` provide a mechansim for parsing XML documents into a DOM document tree represented by an `org.w3c.dom.Document` object.
A `DocumentBuilder` instance is obtained from a `DocumentBuilderFactory` by invoking its `newDocumentBuilder()` method.
NOTE: `DocumentBuilder` uses 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 content into a `org.w3c.dom.Document`. It merely requires that the implementation communicate with the application using these existing APIs.
ATTENTION: THIS IMPLEMENTATION OF THE "JAVAX.XML.PARSER" CLASSES IS NOT THE OFFICIAL REFERENCE IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html
THIS IMPLEMENTATION IS CONFORMANT TO THE "JAVA API FOR XML PARSING" SPECIFICATION VERSION 1.0 PUBLIC RELEASE 1 BY JAMES DUNCAN DAVIDSON PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT http://java.sun.com/xml
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Version:
  1.0 CVS $Revision: 1.3 $ $Date: 2000/09/08 01:35:16 $

Constructor Summary
`protected` | `DocumentBuilder()` Implementors of this abstract class are not required to provide a public no-argument constructor, since instantiation is taken care by `DocumentBuilderFactory` implementations.

Method Summary
`abstract boolean` | `isNamespaceAware()` Returns whether or not this parser supports XML namespaces.
`abstract boolean` | `isValidating()` Returns whether or not this parser supports validating XML content.
`abstract Document` | `newDocument()` Creates an new `Document` instance from the underlying DOM implementation.
`Document` | `parse(java.io.File file)` Parses the content of the given `File` and returns a `Document` object.
`abstract Document` | `parse(InputSource source)` Parses the content of the given `InputSource` and returns a `Document` object.
`Document` | `parse(java.io.InputStream stream)` Parses the contents of the given `InputStream` and returns a `Document` object.
`Document` | `parse(java.lang.String uri)` Parses the content of the given URI and returns a `Document` object.
`abstract void` | `setEntityResolver(EntityResolver er)` Specifies the `EntityResolver` to be used by this `DocumentBuilder`.
`abstract void` | `setErrorHandler(ErrorHandler eh)` Specifies the `ErrorHandler` to be used by this `DocumentBuilder`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DocumentBuilder

    protected DocumentBuilder()

  Implementors of this abstract class are not required to provide a public no-argument constructor, since instantiation is taken care by `DocumentBuilderFactory` implementations.

Method Detail

### parse

    public Document parse(java.io.InputStream stream)
                   throws SAXException,
                          java.io.IOException,
                          java.lang.IllegalArgumentException

  Parses the contents of the given `InputStream` and returns a `Document` object.
  Throws:
    `SAXException` - If there is a problem parsing the given XML content.
    `java.io.IOException` - If any IO errors occur reading the given `InputStream`.
    `java.lang.IllegalArgumentException` - If the given `InputStream` is null.

### parse

    public Document parse(java.lang.String uri)
                   throws SAXException,
                          java.io.IOException,
                          java.lang.IllegalArgumentException

  Parses the content of the given URI and returns a `Document` object.
  Throws:
    `SAXException` - If there is a problem parsing the given XML content.
    `java.io.IOException` - If any IO errors occur while reading content located by the given URI.
    `java.lang.IllegalArgumentException` - If the given URI is null.

### parse

    public Document parse(java.io.File file)
                   throws SAXException,
                          java.io.IOException,
                          java.lang.IllegalArgumentException

  Parses the content of the given `File` and returns a `Document` object.
  Throws:
    `SAXException` - If there is a problem parsing the given XML content.
    `java.io.IOException` - if any IO errors occur while reading content from the given `File`.
    `java.lang.IllegalArgumentException` - if the given `File` is null.

### parse

    public abstract Document parse(InputSource source)
                            throws SAXException,
                                   java.io.IOException,
                                   java.lang.IllegalArgumentException

  Parses the content of the given `InputSource` and returns a `Document` object.
  Throws:
    `SAXException` - If there is a problem parsing the given XML content.
    `java.io.IOException` - if any IO Errors occur while reading content from the given `InputSource`.
    `java.lang.IllegalArgumentException` - if the given `InputSource` is null.

### newDocument

    public abstract Document newDocument()

  Creates an new `Document` instance from the underlying DOM implementation.

### isNamespaceAware

    public abstract boolean isNamespaceAware()

  Returns whether or not this parser supports XML namespaces.

### isValidating

    public abstract boolean isValidating()

  Returns whether or not this parser supports validating XML content.

### setEntityResolver

    public abstract void setEntityResolver(EntityResolver er)

  Specifies the `EntityResolver` to be used by this `DocumentBuilder`.
  Setting the `EntityResolver` to null, or not calling this method, will cause the underlying implementation to use its own default implementation and behavior.

### setErrorHandler

    public abstract void setErrorHandler(ErrorHandler eh)

  Specifies the `ErrorHandler` to be used by this `DocumentBuilder`. Setting the `ErrorHandler` to null, or not calling this method, will cause the underlying implementation to use its own default implementation and behavior.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Xerces 1.2.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD