Top Description Constructors Methods
org.apache.groovy.xml.extensions

public Class XmlExtensions

extends Object
Class Inheritance
Imports
groovy.xml.XmlUtil, org.w3c.dom.Element, .Node, .NodeList, java.util.Iterator

This class defines all the new XML-related groovy methods which enhance the normal JDK XML classes when inside the Groovy environment. Static methods are used with the first parameter the destination class.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Iterator<Node>

Returns:

an Iterator for a NodeList
iterator
(final NodeList
a NodeList
nodeList
)

Makes NodeList iterable by returning a read-only Iterator which traverses over each Node.

public static String

Returns:

the string representation of the element
serialize
(Element
the element to serialize
element
)

Transforms the element to its text equivalent.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

XmlExtensionsback to summary
public XmlExtensions()

Method Detail

iteratorback to summary
public static Iterator<Node> iterator(final NodeList nodeList)

Makes NodeList iterable by returning a read-only Iterator which traverses over each Node.

Parameters
nodeList:NodeList

a NodeList

Returns:Iterator<Node>

an Iterator for a NodeList

Since
1.0
serializeback to summary
public static String serialize(Element element)

Transforms the element to its text equivalent. (The resulting string does not contain a xml declaration. Use XmlUtil.serialize(element) if you need the declaration.)

Parameters
element:Element

the element to serialize

Returns:String

the string representation of the element

Since
2.1