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

## groovy.xml
Class DOMBuilder

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

All Implemented Interfaces:
  GroovyObject

    public class DOMBuilder

extends BuilderSupport

A helper class for creating a W3C DOM tree

Version:
  $Revision: 14076 $
Author:
  James Strachan

Constructor Summary
`DOMBuilder(Document document)`
`DOMBuilder(DocumentBuilder documentBuilder)`

Method Summary
`protected void` | `appendNamespaceAttributes(Element element, Map<Object,Object> attributes)`
`protected Document` | `createDocument()`
`protected Object` | `createNode(Object name)`
`protected Object` | `createNode(Object name, Map attributes)`
`protected Object` | `createNode(Object name, Map attributes, Object value)`
`protected Object` | `createNode(Object name, Object value)`
`static DOMBuilder` | `newInstance()`
`static DOMBuilder` | `newInstance(boolean validating, boolean namespaceAware)`
`static Document` | `parse(Reader reader)` Creates a DocumentBuilder and uses it to parse the XML text read from the given reader.
`static Document` | `parse(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.
`Document` | `parseText(String text)` A helper method to parse the given text as XML.
`protected void` | `setParent(Object parent, Object child)`

Methods inherited from class groovy.util.BuilderSupport
`doInvokeMethod, getCurrent, getName, invokeMethod, invokeMethod, nodeCompleted, postNodeCompletion, setClosureDelegate, setCurrent`

Methods inherited from class groovy.lang.GroovyObjectSupport
`getMetaClass, getProperty, setMetaClass, setProperty`

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

Constructor Detail

### DOMBuilder

    public DOMBuilder(Document document)

### DOMBuilder

    public DOMBuilder(DocumentBuilder documentBuilder)

Method Detail

### newInstance

    public static DOMBuilder newInstance()
                                  throws ParserConfigurationException

  Throws:
    `ParserConfigurationException`

### newInstance

    public static DOMBuilder newInstance(boolean validating,
                                         boolean namespaceAware)
                                  throws ParserConfigurationException

  Throws:
    `ParserConfigurationException`

### parse

    public static Document parse(Reader reader)
                          throws SAXException,
                                 IOException,
                                 ParserConfigurationException

  Creates a DocumentBuilder and uses it to parse the XML text read from the given reader. A non-validating, namespace aware parser is used.

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

### parse

    public static Document parse(Reader reader,
                                 boolean validating,
                                 boolean namespaceAware)
                          throws SAXException,
                                 IOException,
                                 ParserConfigurationException

  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.

  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
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
    `IOException` - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
    `ParserConfigurationException` - if a DocumentBuilder cannot be created which satisfies the configuration requested.

### parseText

    public Document parseText(String text)
                       throws SAXException,
                              IOException,
                              ParserConfigurationException

  A helper method to parse the given text as XML.

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

### setParent

    protected void setParent(Object parent,
                             Object child)

  Specified by:
    `setParent` in class `BuilderSupport`

### createNode

    protected Object createNode(Object name)

  Specified by:
    `createNode` in class `BuilderSupport`

### createDocument

    protected Document createDocument()

### createNode

    protected Object createNode(Object name,
                                Object value)

  Specified by:
    `createNode` in class `BuilderSupport`

### createNode

    protected Object createNode(Object name,
                                Map attributes,
                                Object value)

  Specified by:
    `createNode` in class `BuilderSupport`

### createNode

    protected Object createNode(Object name,
                                Map attributes)

  Specified by:
    `createNode` in class `BuilderSupport`

### appendNamespaceAttributes

    protected void appendNamespaceAttributes(Element element,
                                             Map<Object,Object> attributes)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2003-2009 The Codehaus. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD