Overview | Package | Class | Tree | Deprecated | Index | Help
| Xerces 1.3.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.1 PUBLIC REVIEW 1 BY JAMES DUNCAN DAVIDSON PUBLISHED BY SUN MICROSYSTEMS ON NOV. 2, 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.7 $ $Date: 2001/03/14 22:43:48 $

Constructor Summary
`protected` | `DocumentBuilder()`

Method Summary
`abstract DOMImplementation` | `getDOMImplementation()` Obtain an instance of a `DOMImplementation` object.
`abstract boolean` | `isNamespaceAware()` Indicates whether or not this parser is configured to understand namespaces.
`abstract boolean` | `isValidating()` Indicates whether or not this parser is configured to validate XML documents.
`abstract Document` | `newDocument()` Obtain a new instance of a DOM `Document` object to build a DOM tree with.
`Document` | `parse(java.io.File f)` Parse the content of the given file as an XML document and return a new DOM Document object.
`abstract Document` | `parse(InputSource is)` Parse the content of the given input source as an XML document and return a new DOM Document object.
`Document` | `parse(java.io.InputStream is)` Parse the content of the given InputStream as an XML document and return a new DOM Document object.
`Document` | `parse(java.io.InputStream is, java.lang.String systemId)` Parse the content of the given InputStream as an XML document and return a new DOM Document object.
`Document` | `parse(java.lang.String uri)` Parse the content of the given URI as an XML document and return a new DOM Document object.
`abstract void` | `setEntityResolver(EntityResolver er)` Specify the `EntityResolver` to be used to resolve entities present in the XML document to be parsed.
`abstract void` | `setErrorHandler(ErrorHandler eh)` Specify the `ErrorHandler` to be used to resolve entities present in the XML document to be parsed.

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

Constructor Detail

### DocumentBuilder

    protected DocumentBuilder()

Method Detail

### parse

    public Document parse(java.io.InputStream is)
                   throws SAXException,
                          java.io.IOException

  Parse the content of the given InputStream as an XML document and return a new DOM Document object.
  Parameters:
    `is` - InputStream containing the content to be parsed.
  Throws:
    java.io.IOException - If any IO errors occur.
    SAXException - If any parse errors occur.
    java.lang.IllegalArgumentException - If the InputStream is null
  See Also:
    `DocumentHandler`

### parse

    public Document parse(java.io.InputStream is,
                          java.lang.String systemId)
                   throws SAXException,
                          java.io.IOException

  Parse the content of the given InputStream as an XML document and return a new DOM Document object.
  Parameters:
    `is` - InputStream containing the content to be parsed.
    `systemId` - Provide a base for resolving relative URIs.
  Throws:
    java.io.IOException - If any IO errors occur.
    SAXException - If any parse errors occur.
    java.lang.IllegalArgumentException - If the InputStream is null
  See Also:
    `DocumentHandler`

### parse

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

  Parse the content of the given URI as an XML document and return a new DOM Document object.
  Parameters:
    `uri` - The location of the content to be parsed.
  Throws:
    java.io.IOException - If any IO errors occur.
    SAXException - If any parse errors occur.
    java.lang.IllegalArgumentException - If the URI is null
  See Also:
    `DocumentHandler`

### parse

    public Document parse(java.io.File f)
                   throws SAXException,
                          java.io.IOException

  Parse the content of the given file as an XML document and return a new DOM Document object.
  Parameters:
    `f` - The file containing the XML to parse
  Throws:
    java.io.IOException - If any IO errors occur.
    SAXException - If any parse errors occur.
    java.lang.IllegalArgumentException - If the file is null
  See Also:
    `DocumentHandler`

### parse

    public abstract Document parse(InputSource is)
                            throws SAXException,
                                   java.io.IOException

  Parse the content of the given input source as an XML document and return a new DOM Document object.
  Parameters:
    `is` - InputSource containing the content to be parsed.
  Throws:
    java.io.IOException - If any IO errors occur.
    SAXException - If any parse errors occur.
    java.lang.IllegalArgumentException - If the InputSource is null
  See Also:
    `DocumentHandler`

### isNamespaceAware

    public abstract boolean isNamespaceAware()

  Indicates whether or not this parser is configured to understand namespaces.

### isValidating

    public abstract boolean isValidating()

  Indicates whether or not this parser is configured to validate XML documents.

### setEntityResolver

    public abstract void setEntityResolver(EntityResolver er)

  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.

### setErrorHandler

    public abstract void setErrorHandler(ErrorHandler eh)

  Specify the `ErrorHandler` 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.

### newDocument

    public abstract Document newDocument()

  Obtain a new instance of a DOM `Document` object to build a DOM tree with. An alternative way to create a DOM Document object is to use the `getDOMImplementation` method to get a DOM Level 2 DOMImplementation object and then use DOM Level 2 methods on that object to create a DOM Document object.
  Returns:
    A new instance of a DOM Document object.

### getDOMImplementation

    public abstract DOMImplementation getDOMImplementation()

  Obtain an instance of a `DOMImplementation` object.
  Returns:
    A new instance of a `DOMImplementation`.

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