Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.xml
[Java] Class DOMBuilder

    java.lang.Object
      groovy.lang.GroovyObjectSupport
          groovy.util.BuilderSupport
              groovy.xml.DOMBuilder

    public class DOMBuilder
    extends BuilderSupport

A helper class for creating a W3C DOM tree

Authors:
  James Strachan

Version:
  \$Revision\$

Constructor Summary
`DOMBuilder(org.w3c.dom.Document document)`
`DOMBuilder(javax.xml.parsers.DocumentBuilder documentBuilder)`

Method Summary
`protected void` | `appendNamespaceAttributes(org.w3c.dom.Element element, java.util.Map attributes)`
`protected org.w3c.dom.Document` | `createDocument()`
`protected java.lang.Object` | `createNode(java.lang.Object name)`
`protected java.lang.Object` | `createNode(java.lang.Object name, java.lang.Object value)`
`protected java.lang.Object` | `createNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)`
`protected java.lang.Object` | `createNode(java.lang.Object name, java.util.Map attributes)`
`static DOMBuilder` | `newInstance()`
`static DOMBuilder` | `newInstance(boolean validating, boolean namespaceAware)`
`static org.w3c.dom.Document` | `parse(java.io.Reader reader)` Creates a DocumentBuilder and uses it to parse the XML text read from the given reader.
`static org.w3c.dom.Document` | `parse(java.io.Reader reader, boolean validating, boolean namespaceAware)` Creates a DocumentBuilder and uses it to parse the XML text read from the given reader, allowing parser validation and namespace awareness to be controlled.
`org.w3c.dom.Document` | `parseText(java.lang.String text)` A helper method to parse the given text as XML.
`protected void` | `setParent(java.lang.Object parent, java.lang.Object child)`

Methods inherited from class BuilderSupport
createNode, createNode, createNode, createNode, doInvokeMethod, getCurrent, getName, invokeMethod, invokeMethod, nodeCompleted, postNodeCompletion, setClosureDelegate, setCurrent, setParent

Methods inherited from class GroovyObjectSupport
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Constructor Detail

### DOMBuilder

    public DOMBuilder(org.w3c.dom.Document document)

### DOMBuilder

    public DOMBuilder(javax.xml.parsers.DocumentBuilder documentBuilder)

Method Detail

### appendNamespaceAttributes

    protected void appendNamespaceAttributes(org.w3c.dom.Element element, java.util.Map attributes)

### createDocument

    protected org.w3c.dom.Document createDocument()

### createNode

    protected java.lang.Object createNode(java.lang.Object name)

### createNode

    protected java.lang.Object createNode(java.lang.Object name, java.lang.Object value)

### createNode

    protected java.lang.Object createNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)

### createNode

    protected java.lang.Object createNode(java.lang.Object name, java.util.Map attributes)

### newInstance

    public static DOMBuilder newInstance()

### newInstance

    public static DOMBuilder newInstance(boolean validating, boolean namespaceAware)

### parse

    public static org.w3c.dom.Document parse(java.io.Reader reader)

  Creates a DocumentBuilder and uses it to parse the XML text read from the given reader. A non-validating, namespace aware parser is used.
  throws:
    SAXException Any SAX exception, possibly wrapping another exception.
  throws:
    IOException An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
  throws:
    ParserConfigurationException if a DocumentBuilder cannot be created which satisfies the configuration requested.
  Parameters:
    `reader` - the reader to read the XML text from
  Returns:
    the root node of the parsed tree of Nodes
  See Also:
    parse(Reader, boolean, boolean)

### parse

    public static org.w3c.dom.Document parse(java.io.Reader reader, boolean validating, boolean namespaceAware)

  Creates a DocumentBuilder and uses it to parse the XML text read from the given reader, allowing parser validation and namespace awareness to be controlled.
  throws:
    SAXException Any SAX exception, possibly wrapping another exception.
  throws:
    IOException An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
  throws:
    ParserConfigurationException if a DocumentBuilder cannot be created which satisfies the configuration requested.
  Parameters:
    `reader` - the reader to read the XML text from
    `validating` - whether to validate the XML
    `namespaceAware` - whether the parser should be namespace aware
  Returns:
    the root node of the parsed tree of Nodes

### parseText

    public org.w3c.dom.Document parseText(java.lang.String text)

  A helper method to parse the given text as XML.
  throws:
    SAXException Any SAX exception, possibly wrapping another exception.
  throws:
    IOException An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
  throws:
    ParserConfigurationException if a DocumentBuilder cannot be created which satisfies the configuration requested.
  Parameters:
    `text` - the XML text to parse
  Returns:
    the root node of the parsed tree of Nodes
  See Also:
    parse(Reader)

### setParent

    protected void setParent(java.lang.Object parent, java.lang.Object child)

Groovy Documentation