Package groovy.xml.dom

# Class DOMCategory

java.lang.Object
groovy.xml.dom.DOMCategory

public class DOMCategory extends Object
Category class which adds GPath style operations to Java's DOM classes.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DOMCategory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Element`
  `appendNode(Element self, Object name)`
  `static Element`
  `appendNode(Element self, Object name, String value)`
  `static Element`
  `appendNode(Element self, Object name, Map attributes)`
  `static Element`
  `appendNode(Element self, Object name, Map attributes, String value)`
  `static NamedNodeMap`
  `attributes(Element element)`
  `static NodeList`
  `breadthFirst(Element self)`
  `static NodeList`
  `children(Element self)`
  `static NodeList`
  `depthFirst(Element self)`
  `static Object`
  `get(Element element, String elementName)`
  `static Object`
  `get(NamedNodeMap nodeMap, String elementName)`
  `static Object`
  `get(NodeList nodeList, String elementName)`
  `static Node`
  `getAt(groovy.xml.dom.DOMCategory.NodeListsHolder o, int i)`
  `static NodeList`
  `getAt(groovy.xml.dom.DOMCategory.NodeListsHolder o, IntRange r)`
  `static Node`
  `getAt(groovy.xml.dom.DOMCategory.NodesHolder o, int i)`
  `static NodeList`
  `getAt(groovy.xml.dom.DOMCategory.NodesHolder o, IntRange r)`
  `static Node`
  `getAt(Node o, int i)`
  `static NodeList`
  `getAt(Node o, IntRange r)`
  `static boolean`
  `isEmpty(NodeList self)`
  `static boolean`
  `isGlobalKeepIgnorableWhitespace()`
  `static boolean`
  `isGlobalTrimWhitespace()`
  `static List<Node>`
  `list(NodeList self)`
  `static List<String>`
  `localText(Element self)`
  Returns the list of any direct String nodes of this node.
  `static String`
  `name(Node node)`
  `static Node`
  `parent(Node node)`
  `static void`
  `plus(Element self, Closure c)`
  `static void`
  `plus(NodeList self, Closure c)`
  `static void`
  `putAt(Element self, String property, Object value)`
  `static Node`
  `replaceNode(groovy.xml.dom.DOMCategory.NodesHolder self, Closure c)`
  `static Node`
  `replaceNode(Node self, Closure c)`
  `static void`
  `setGlobalKeepIgnorableWhitespace(boolean keepIgnorableWhitespace)`
  Whether ignorable whitespace (e.g.
  `static void`
  `setGlobalTrimWhitespace(boolean trimWhitespace)`
  Whether text content is trimmed (removing leading and trailing whitespace); default false.
  `static void`
  `setValue(Element self, String value)`
  `static int`
  `size(NamedNodeMap namedNodeMap)`
  `static int`
  `size(NodeList self)`
  `static String`
  `text(Node node)`
  `static String`
  `text(NodeList nodeList)`
  `static String`
  `toString(Object o)`
  `static String`
  `xpath(Node self, String expression)`
  `static Object`
  `xpath(Node self, String expression, QName returnType)`

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

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

- ## Constructor Details

  - ### DOMCategory

    public DOMCategory()

- ## Method Details

  - ### isGlobalTrimWhitespace

    public static boolean isGlobalTrimWhitespace()
    Returns:
      true if text elements are trimmed before returning; default false

  - ### setGlobalTrimWhitespace

    public static void setGlobalTrimWhitespace(boolean trimWhitespace)
    Whether text content is trimmed (removing leading and trailing whitespace); default false. WARNING: this is a global setting. Altering it will affect all DOMCategory usage within the current Java process. It is not recommended that this is altered; instead call the trim() method on the returned text, but the flag is available to support legacy Groovy behavior.
    Parameters:
      `trimWhitespace` - the new value

  - ### isGlobalKeepIgnorableWhitespace

    public static boolean isGlobalKeepIgnorableWhitespace()
    Returns:
      true if ignorable whitespace (e.g. whitespace between elements) is kept; default false

  - ### setGlobalKeepIgnorableWhitespace

    public static void setGlobalKeepIgnorableWhitespace(boolean keepIgnorableWhitespace)
    Whether ignorable whitespace (e.g. whitespace between elements) is kept (default false). WARNING: this is a global setting. Altering it will affect all DOMCategory usage within the current Java process.
    Parameters:
      `keepIgnorableWhitespace` - the new value

  - ### get

    public static Object get(Element element, String elementName)

  - ### get

    public static Object get(NodeList nodeList, String elementName)

  - ### get

    public static Object get(NamedNodeMap nodeMap, String elementName)

  - ### attributes

    public static NamedNodeMap attributes(Element element)

  - ### size

    public static int size(NamedNodeMap namedNodeMap)

  - ### getAt

    public static Node getAt(Node o, int i)

  - ### getAt

    public static Node getAt(groovy.xml.dom.DOMCategory.NodeListsHolder o, int i)

  - ### getAt

    public static Node getAt(groovy.xml.dom.DOMCategory.NodesHolder o, int i)

  - ### getAt

    public static NodeList getAt(Node o, IntRange r)

  - ### getAt

    public static NodeList getAt(groovy.xml.dom.DOMCategory.NodeListsHolder o, IntRange r)

  - ### getAt

    public static NodeList getAt(groovy.xml.dom.DOMCategory.NodesHolder o, IntRange r)

  - ### name

    public static String name(Node node)

  - ### parent

    public static Node parent(Node node)

  - ### text

    public static String text(Node node)

  - ### text

    public static String text(NodeList nodeList)

  - ### list

    public static List<Node> list(NodeList self)

  - ### depthFirst

    public static NodeList depthFirst(Element self)

  - ### setValue

    public static void setValue(Element self, String value)

  - ### putAt

    public static void putAt(Element self, String property, Object value)

  - ### appendNode

    public static Element appendNode(Element self, Object name)

  - ### appendNode

    public static Element appendNode(Element self, Object name, Map attributes)

  - ### appendNode

    public static Element appendNode(Element self, Object name, String value)

  - ### appendNode

    public static Element appendNode(Element self, Object name, Map attributes, String value)

  - ### replaceNode

    public static Node replaceNode(groovy.xml.dom.DOMCategory.NodesHolder self, Closure c)

  - ### replaceNode

    public static Node replaceNode(Node self, Closure c)

  - ### plus

    public static void plus(Element self, Closure c)

  - ### localText

    public static List<String> localText(Element self)
    Returns the list of any direct String nodes of this node.
    Returns:
      the list of String values from this node
    Since:
      2.3.0

  - ### plus

    public static void plus(NodeList self, Closure c)

  - ### breadthFirst

    public static NodeList breadthFirst(Element self)

  - ### children

    public static NodeList children(Element self)

  - ### toString

    public static String toString(Object o)

  - ### xpath

    public static Object xpath(Node self, String expression, QName returnType)

  - ### xpath

    public static String xpath(Node self, String expression)

  - ### size

    public static int size(NodeList self)

  - ### isEmpty

    public static boolean isEmpty(NodeList self)