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

## org.jdom.input
Class DOMBuilder

    java.lang.Object
      |
      +--org.jdom.input.DOMBuilder

public class DOMBuilder
extends Object

`DOMBuilder` builds a JDOM tree using DOM. Note that this class should only be used for building from a pre-existing DOM tree. The class can be used to build from files, streams, etc but other builders like SAXBuilder can perform the task faster because they don't create a DOM tree first.

Version:
  1.0
Author:
  Brett McLaughlin, Jason Hunter, Philip Nelson, Kevin Regan, Yusuf Goolamabbas, Dan Schaffer

Constructor Summary
`DOMBuilder()` This creates a new DOMBuilder which will attempt to first locate a parser via JAXP, then will try to use a set of default parsers.
`DOMBuilder(boolean validate)` This creates a new DOMBuilder which will attempt to first locate a parser via JAXP, then will try to use a set of default parsers.
`DOMBuilder(String adapterClass)` This creates a new DOMBuilder using the specified DOMAdapter implementation as a way to choose the underlying parser.
`DOMBuilder(String adapterClass, boolean validate)` This creates a new DOMBuilder using the specified DOMAdapter implementation as a way to choose the underlying parser.

Method Summary
`Document` | `build(Document domDocument)` This will build a JDOM tree from an existing DOM tree.
`Element` | `build(Element domElement)` This will build a JDOM Element from an existing DOM Element
`Document` | `build(File file)` This builds a document from the supplied filename by constructing a DOM tree and reading information from the DOM to create a JDOM document, a slower approach than SAXBuilder but useful for debugging.
`Document` | `build(InputStream in)` This builds a document from the supplied input stream by constructing a DOM tree and reading information from the DOM to create a JDOM document, a slower approach than SAXBuilder but useful for debugging.
`Document` | `build(URL url)` This builds a document from the supplied URL by constructing a DOM tree and reading information from the DOM to create a JDOM document, a slower approach than SAXBuilder but useful for debugging.
`void` | `setFactory(JDOMFactory factory)`
`void` | `setValidation(boolean validate)` This sets validation for the builder.

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

Constructor Detail

### DOMBuilder

    public DOMBuilder()

  This creates a new DOMBuilder which will attempt to first locate a parser via JAXP, then will try to use a set of default parsers. The underlying parser will not validate.

### DOMBuilder

    public DOMBuilder(boolean validate)

  This creates a new DOMBuilder which will attempt to first locate a parser via JAXP, then will try to use a set of default parsers. The underlying parser will validate or not according to the given parameter.

  Parameters:
    `validate` - `boolean` indicating if validation should occur.

### DOMBuilder

    public DOMBuilder(String adapterClass)

  This creates a new DOMBuilder using the specified DOMAdapter implementation as a way to choose the underlying parser. The underlying parser will not validate.

  Parameters:
    `adapterClass` - `String` name of class to use for DOM building.

### DOMBuilder

    public DOMBuilder(String adapterClass,
                      boolean validate)

  This creates a new DOMBuilder using the specified DOMAdapter implementation as a way to choose the underlying parser. The underlying parser will validate or not according to the given parameter.

  Parameters:
    `adapterClass` - `String` name of class to use for DOM building.
    `validate` - `boolean` indicating if validation should occur.

Method Detail

### setFactory

    public void setFactory(JDOMFactory factory)

### setValidation

    public void setValidation(boolean validate)

  This sets validation for the builder.

  Parameters:
    `validate` - `boolean` indicating whether validation should occur.

### build

    public Document build(InputStream in)
                   throws JDOMException

  This builds a document from the supplied input stream by constructing a DOM tree and reading information from the DOM to create a JDOM document, a slower approach than SAXBuilder but useful for debugging.

  Parameters:
    `in` - `InputStream` to read from.
  Returns:
    `Document` - resultant Document object.
  Throws:
    JDOMException - when errors occur in parsing.

### build

    public Document build(File file)
                   throws JDOMException

  This builds a document from the supplied filename by constructing a DOM tree and reading information from the DOM to create a JDOM document, a slower approach than SAXBuilder but useful for debugging.

  Parameters:
    `file` - `File` to read from.
  Returns:
    `Document` - resultant Document object.
  Throws:
    JDOMException - when errors occur in parsing.

### build

    public Document build(URL url)
                   throws JDOMException

  This builds a document from the supplied URL by constructing a DOM tree and reading information from the DOM to create a JDOM document, a slower approach than SAXBuilder but useful for debugging.

  Parameters:
    `url` - `URL` to read from.
  Returns:
    `Document` - resultant Document object.
  Throws:
    JDOMException - when errors occur in parsing.

### build

    public Document build(Document domDocument)

  This will build a JDOM tree from an existing DOM tree.

  Parameters:
    `domDocument` - `org.w3c.dom.Document` object
  Returns:
    `Document` - JDOM document object.

### build

    public Element build(Element domElement)

  This will build a JDOM Element from an existing DOM Element

  Parameters:
    `domElement` - `org.w3c.dom.Element` object
  Returns:
    `Element` - JDOM Element object

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

Copyright © 2001 Jason Hunter, Brett McLaughlin. All Rights Reserved.