Package org.apache.tools.ant.util

# Class DOMUtils

java.lang.Object
org.apache.tools.ant.util.DOMUtils

    public class DOMUtils
    extends java.lang.Object

Some utility methods for common tasks when building DOM trees in memory.

In this documentation `<a>` means an `Element` instance with name `a`.

Since:
  Ant 1.6.3

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `static void` | `appendCDATA​(org.w3c.dom.Element parent, java.lang.String content)` | Adds a nested CDATA section.
  `static void` | `appendCDATAElement​(org.w3c.dom.Element parent, java.lang.String name, java.lang.String content)` | Adds a nested CDATA section in a new child element.
  `static void` | `appendText​(org.w3c.dom.Element parent, java.lang.String content)` | Adds nested text.
  `static void` | `appendTextElement​(org.w3c.dom.Element parent, java.lang.String name, java.lang.String content)` | Adds nested text in a new child element.
  `static org.w3c.dom.Element` | `createChildElement​(org.w3c.dom.Element parent, java.lang.String name)` | Creates a named Element and appends it to the given element, returns it.
  `static org.w3c.dom.Document` | `newDocument()` | Get a new Document instance,

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### newDocument

    public static org.w3c.dom.Document newDocument()
    Get a new Document instance,
    Returns:
      the document.
    Since:
      Ant 1.6.3

  - ### createChildElement

    public static org.w3c.dom.Element createChildElement​(org.w3c.dom.Element parent, java.lang.String name)
    Creates a named Element and appends it to the given element, returns it.

    This means

        createChildElement(<a>, "b")

    creates

         <a>
           <b/>
         </a>

    and returns `<b>`.
    Parameters:
      `parent` - element that will receive the new element as child.
      `name` - name of the new element.
    Returns:
      the new element.
    Since:
      Ant 1.6.3

  - ### appendText

    public static void appendText​(org.w3c.dom.Element parent, java.lang.String content)
    Adds nested text.

    This means

        appendText(<a>, "b")

    creates

         <a>b</a>

    Parameters:
      `parent` - element that will receive the new element as child.
      `content` - text content.
    Since:
      Ant 1.6.3

  - ### appendCDATA

    public static void appendCDATA​(org.w3c.dom.Element parent, java.lang.String content)
    Adds a nested CDATA section.

    This means

        appendCDATA(<a>, "b")

    creates

         <a><[!CDATA[b]]></a>

    Parameters:
      `parent` - element that will receive the new element as child.
      `content` - text content.
    Since:
      Ant 1.6.3

  - ### appendTextElement

    public static void appendTextElement​(org.w3c.dom.Element parent, java.lang.String name, java.lang.String content)
    Adds nested text in a new child element.

    This means

        appendTextElement(<a>, "b", "c")

    creates

         <a>
           <b>c</b>
         </a>

    Parameters:
      `parent` - element that will receive the new element as child.
      `name` - of the child element.
      `content` - text content.
    Since:
      Ant 1.6.3

  - ### appendCDATAElement

    public static void appendCDATAElement​(org.w3c.dom.Element parent, java.lang.String name, java.lang.String content)
    Adds a nested CDATA section in a new child element.

    This means

        appendCDATAElement(<a>, "b", "c")

    creates

         <a>
           <b><![CDATA[c]]></b>
         </a>

    Parameters:
      `parent` - element that will receive the new element as child.
      `name` - of the child element.
      `content` - text content.
    Since:
      Ant 1.6.3