Class DOMCategory


  • public class DOMCategory
    extends java.lang.Object
    Category class which adds GPath style operations to Java's DOM classes.
    • Constructor Summary

      Constructors 
      Constructor Description
      DOMCategory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.w3c.dom.Element appendNode​(org.w3c.dom.Element self, java.lang.Object name)  
      static org.w3c.dom.Element appendNode​(org.w3c.dom.Element self, java.lang.Object name, java.lang.String value)  
      static org.w3c.dom.Element appendNode​(org.w3c.dom.Element self, java.lang.Object name, java.util.Map attributes)  
      static org.w3c.dom.Element appendNode​(org.w3c.dom.Element self, java.lang.Object name, java.util.Map attributes, java.lang.String value)  
      static org.w3c.dom.NamedNodeMap attributes​(org.w3c.dom.Element element)  
      static org.w3c.dom.NodeList breadthFirst​(org.w3c.dom.Element self)  
      static org.w3c.dom.NodeList children​(org.w3c.dom.Element self)  
      static org.w3c.dom.NodeList depthFirst​(org.w3c.dom.Element self)  
      static java.lang.Object get​(org.w3c.dom.Element element, java.lang.String elementName)  
      static java.lang.Object get​(org.w3c.dom.NamedNodeMap nodeMap, java.lang.String elementName)  
      static java.lang.Object get​(org.w3c.dom.NodeList nodeList, java.lang.String elementName)  
      static org.w3c.dom.Node getAt​(groovy.xml.dom.DOMCategory.NodeListsHolder o, int i)  
      static org.w3c.dom.NodeList getAt​(groovy.xml.dom.DOMCategory.NodeListsHolder o, IntRange r)  
      static org.w3c.dom.Node getAt​(groovy.xml.dom.DOMCategory.NodesHolder o, int i)  
      static org.w3c.dom.NodeList getAt​(groovy.xml.dom.DOMCategory.NodesHolder o, IntRange r)  
      static org.w3c.dom.Node getAt​(org.w3c.dom.Node o, int i)  
      static org.w3c.dom.NodeList getAt​(org.w3c.dom.Node o, IntRange r)  
      static boolean isEmpty​(org.w3c.dom.NodeList self)  
      static boolean isGlobalKeepIgnorableWhitespace()  
      static boolean isGlobalTrimWhitespace()  
      static java.util.List<org.w3c.dom.Node> list​(org.w3c.dom.NodeList self)  
      static java.util.List<java.lang.String> localText​(org.w3c.dom.Element self)
      Returns the list of any direct String nodes of this node.
      static java.lang.String name​(org.w3c.dom.Node node)  
      static org.w3c.dom.Node parent​(org.w3c.dom.Node node)  
      static void plus​(org.w3c.dom.Element self, Closure c)  
      static void plus​(org.w3c.dom.NodeList self, Closure c)  
      static void putAt​(org.w3c.dom.Element self, java.lang.String property, java.lang.Object value)  
      static org.w3c.dom.Node replaceNode​(groovy.xml.dom.DOMCategory.NodesHolder self, Closure c)  
      static org.w3c.dom.Node replaceNode​(org.w3c.dom.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​(org.w3c.dom.Element self, java.lang.String value)  
      static int size​(org.w3c.dom.NamedNodeMap namedNodeMap)  
      static int size​(org.w3c.dom.NodeList self)  
      static java.lang.String text​(org.w3c.dom.Node node)  
      static java.lang.String text​(org.w3c.dom.NodeList nodeList)  
      static java.lang.String toString​(java.lang.Object o)  
      static java.lang.String xpath​(org.w3c.dom.Node self, java.lang.String expression)  
      static java.lang.Object xpath​(org.w3c.dom.Node self, java.lang.String expression, javax.xml.namespace.QName returnType)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DOMCategory

        public DOMCategory()
    • Method Detail

      • 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 java.lang.Object get​(org.w3c.dom.Element element,
                                           java.lang.String elementName)
      • get

        public static java.lang.Object get​(org.w3c.dom.NodeList nodeList,
                                           java.lang.String elementName)
      • get

        public static java.lang.Object get​(org.w3c.dom.NamedNodeMap nodeMap,
                                           java.lang.String elementName)
      • attributes

        public static org.w3c.dom.NamedNodeMap attributes​(org.w3c.dom.Element element)
      • size

        public static int size​(org.w3c.dom.NamedNodeMap namedNodeMap)
      • getAt

        public static org.w3c.dom.Node getAt​(org.w3c.dom.Node o,
                                             int i)
      • getAt

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

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

        public static org.w3c.dom.NodeList getAt​(org.w3c.dom.Node o,
                                                 IntRange r)
      • getAt

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

        public static org.w3c.dom.NodeList getAt​(groovy.xml.dom.DOMCategory.NodesHolder o,
                                                 IntRange r)
      • name

        public static java.lang.String name​(org.w3c.dom.Node node)
      • parent

        public static org.w3c.dom.Node parent​(org.w3c.dom.Node node)
      • text

        public static java.lang.String text​(org.w3c.dom.Node node)
      • text

        public static java.lang.String text​(org.w3c.dom.NodeList nodeList)
      • list

        public static java.util.List<org.w3c.dom.Node> list​(org.w3c.dom.NodeList self)
      • depthFirst

        public static org.w3c.dom.NodeList depthFirst​(org.w3c.dom.Element self)
      • setValue

        public static void setValue​(org.w3c.dom.Element self,
                                    java.lang.String value)
      • putAt

        public static void putAt​(org.w3c.dom.Element self,
                                 java.lang.String property,
                                 java.lang.Object value)
      • appendNode

        public static org.w3c.dom.Element appendNode​(org.w3c.dom.Element self,
                                                     java.lang.Object name)
      • appendNode

        public static org.w3c.dom.Element appendNode​(org.w3c.dom.Element self,
                                                     java.lang.Object name,
                                                     java.util.Map attributes)
      • appendNode

        public static org.w3c.dom.Element appendNode​(org.w3c.dom.Element self,
                                                     java.lang.Object name,
                                                     java.lang.String value)
      • appendNode

        public static org.w3c.dom.Element appendNode​(org.w3c.dom.Element self,
                                                     java.lang.Object name,
                                                     java.util.Map attributes,
                                                     java.lang.String value)
      • replaceNode

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

        public static org.w3c.dom.Node replaceNode​(org.w3c.dom.Node self,
                                                   Closure c)
      • plus

        public static void plus​(org.w3c.dom.Element self,
                                Closure c)
      • localText

        public static java.util.List<java.lang.String> localText​(org.w3c.dom.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​(org.w3c.dom.NodeList self,
                                Closure c)
      • breadthFirst

        public static org.w3c.dom.NodeList breadthFirst​(org.w3c.dom.Element self)
      • children

        public static org.w3c.dom.NodeList children​(org.w3c.dom.Element self)
      • toString

        public static java.lang.String toString​(java.lang.Object o)
      • xpath

        public static java.lang.Object xpath​(org.w3c.dom.Node self,
                                             java.lang.String expression,
                                             javax.xml.namespace.QName returnType)
      • xpath

        public static java.lang.String xpath​(org.w3c.dom.Node self,
                                             java.lang.String expression)
      • size

        public static int size​(org.w3c.dom.NodeList self)
      • isEmpty

        public static boolean isEmpty​(org.w3c.dom.NodeList self)