[Java] Class DOMCategory
- groovy.xml.dom.DOMCategory
public class DOMCategory extends Object
Category class which adds GPath style operations to Java's DOM classes.
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public static Element |
appendNode(Element self, Object name) | |
public static Element |
appendNode(Element self, Object name, Map attributes) | |
public static Element |
appendNode(Element self, Object name, String value) | |
public static Element |
appendNode(Element self, Object name, Map attributes, String value) | |
public static NamedNodeMap |
attributes(Element element) | |
public static NodeList |
breadthFirst(Element self) | |
public static NodeList |
children(Element self) | |
public static NodeList |
depthFirst(Element self) | |
public static Object |
get(Element element, String elementName) | |
public static Object |
get(NodeList nodeList, String elementName) | |
public static Object |
get(NamedNodeMap nodeMap, String elementName) | |
public static Node |
getAt(Node o, int i) | |
public static Node |
getAt(DOMCategory.NodeListsHolder o, int i) | |
public static Node |
getAt(DOMCategory.NodesHolder o, int i) | |
public static NodeList |
getAt(Node o, IntRange r) | |
public static NodeList |
getAt(DOMCategory.NodeListsHolder o, IntRange r) | |
public static NodeList |
getAt(DOMCategory.NodesHolder o, IntRange r) | |
public static boolean |
isEmpty(NodeList self) | |
public static boolean |
isGlobalKeepIgnorableWhitespace()
| |
public static boolean |
isGlobalTrimWhitespace()
| |
public static List<Node> |
list(NodeList self) | |
public static List<String> |
localText(Element self) Returns the list of any direct String nodes of this node. | |
public static String |
name(Node node) | |
public static Node |
parent(Node node) | |
public static void |
plus(Element self, Closure c) | |
public static void |
plus(NodeList self, Closure c) | |
public static void |
putAt(Element self, String property, Object value) | |
public static Node |
replaceNode(DOMCategory.NodesHolder self, Closure c) | |
public static Node |
replaceNode(Node self, Closure c) | |
public static void |
setGlobalKeepIgnorableWhitespace(boolean keepIgnorableWhitespace) Whether ignorable whitespace (e.g. whitespace between elements) is kept (default false). | |
public static void |
setGlobalTrimWhitespace(boolean trimWhitespace) Whether text content is trimmed (removing leading and trailing whitespace); default false. | |
public static void |
setValue(Element self, String value) | |
public static int |
size(NamedNodeMap namedNodeMap) | |
public static int |
size(NodeList self) | |
public static String |
text(Node node) | |
public static String |
text(NodeList nodeList) | |
public static String |
toString(Object o) | |
public static Object |
xpath(Node self, String expression, QName returnType) | |
public static String |
xpath(Node self, String expression) |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class Object | wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Method Detail
public static Element appendNode(Element self, Object name)
public static Element appendNode(Element self, Object name, Map attributes)
public static Element appendNode(Element self, Object name, String value)
public static Element appendNode(Element self, Object name, Map attributes, String value)
public static NamedNodeMap attributes(Element element)
public static NodeList breadthFirst(Element self)
public static NodeList children(Element self)
public static NodeList depthFirst(Element self)
public static Object get(Element element, String elementName)
public static Object get(NodeList nodeList, String elementName)
public static Object get(NamedNodeMap nodeMap, String elementName)
public static Node getAt(Node o, int i)
public static Node getAt(DOMCategory.NodeListsHolder o, int i)
public static Node getAt(DOMCategory.NodesHolder o, int i)
public static NodeList getAt(Node o, IntRange r)
public static NodeList getAt(DOMCategory.NodeListsHolder o, IntRange r)
public static NodeList getAt(DOMCategory.NodesHolder o, IntRange r)
public static boolean isEmpty(NodeList self)
public static boolean isGlobalKeepIgnorableWhitespace()
- Returns:
- true if ignorable whitespace (e.g. whitespace between elements) is kept; default false
public static boolean isGlobalTrimWhitespace()
- Returns:
- true if text elements are trimmed before returning; default false
public static List<Node> list(NodeList self)
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
public static String name(Node node)
public static Node parent(Node node)
public static void plus(Element self, Closure c)
public static void plus(NodeList self, Closure c)
public static void putAt(Element self, String property, Object value)
public static Node replaceNode(DOMCategory.NodesHolder self, Closure c)
public static Node replaceNode(Node self, Closure c)
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
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
public static void setValue(Element self, String value)
public static int size(NamedNodeMap namedNodeMap)
public static int size(NodeList self)
public static String text(Node node)
public static String text(NodeList nodeList)
public static String toString(Object o)
public static Object xpath(Node self, String expression, QName returnType)
public static String xpath(Node self, String expression)
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/groovy/xml/dom/DOMCategory.html