Top Description Fields Constructors Methods
groovy.xml.slurpersupport

public Class NodeChildren

extends GPathResult
Class Inheritance
Known Direct Subclasses
groovy.xml.slurpersupport.NodeParents, groovy.xml.slurpersupport.Attributes, groovy.xml.slurpersupport.FilteredNodeChildren
Imports
groovy.lang.Buildable, .Closure, .GroovyObject, .GroovyRuntimeException, org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation, java.io.IOException, .Writer, java.util.Iterator, .Map

Lazy evaluated representation of child nodes.

Field Summary

Modifier and TypeField and Description
private int
Inherited from groovy.xml.slurpersupport.GPathResult:
namenamespaceMapnamespacePrefixnamespaceTagHintsparent

Constructor Summary

AccessConstructor and Description
public
NodeChildren(final GPathResult
the GPathResult prior to the application of the expression creating this GPathResult
parent
,
final String
if the GPathResult corresponds to something with a name, e.g. a node
name
,
final String
the namespace prefix if any
namespacePrefix
,
final Map<String, String>
the known tag to namespace mappings
namespaceTagHints
)

public
NodeChildren(final GPathResult
the GPathResult prior to the application of the expression creating this GPathResult
parent
,
final String
if the GPathResult corresponds to something with a name, e.g. a node
name
,
final Map<String, String>
the known tag to namespace mappings
namespaceTagHints
)

public
NodeChildren(final GPathResult
the GPathResult prior to the application of the expression creating this GPathResult
parent
,
final Map<String, String>
the known tag to namespace mappings
namespaceTagHints
)

Method Summary

Modifier and TypeMethod and Description
protected void
public void
public Iterator<E>
childNodes()

Implements abstract groovy.xml.slurpersupport.GPathResult.childNodes.

Returns an iterator over the child nodes of this GPathResult.
public GPathResult
find(final Closure<V>
a closure to filters the children of this GPathResult
closure
)

Implements abstract groovy.xml.slurpersupport.GPathResult.find.

Returns the first child of this GPathResult matching the condition(s) specified in the passed closure.
public GPathResult
findAll(final Closure<V>
a closure to filters the children of this GPathResult
closure
)

Implements abstract groovy.xml.slurpersupport.GPathResult.findAll.

Returns the children of this GPathResult matching the condition(s) specified in the passed closure.
public Iterator<E>
iterator()

Implements abstract groovy.xml.slurpersupport.GPathResult.iterator.

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public Iterator<E>
public GPathResult
parents()

Implements abstract groovy.xml.slurpersupport.GPathResult.parents.

Throws a GroovyRuntimeException, because it is not implemented yet.
protected void
protected void
public synchronized int
size()

Implements abstract groovy.xml.slurpersupport.GPathResult.size.

Returns the size of this GPathResult.
public String
text()

Implements abstract groovy.xml.slurpersupport.GPathResult.text.

Returns the text of this GPathResult as a String.
public Writer
writeTo(final Writer
the Writer to which this Writable should output its data.
out
)

Implements groovy.lang.Writable.writeTo.

Writes this object to the given writer.
Inherited from groovy.xml.slurpersupport.GPathResult:
breadthFirstchildrencreateIteratordeclareNamespacedepthFirstequalsgetAtgetAtgetBodygetPropertyhashCodeisEmptyleftShiftlistlookupNamespacenameparentpluspopputAtsetMetaClasssetPropertytoBigDecimaltoBigIntegertoBooleantoDoubletoFloattoIntegertoLongtoStringtoURItoURL

Field Detail

sizeback to summary
private int size

Constructor Detail

NodeChildrenback to summary
public NodeChildren(final GPathResult parent, final String name, final String namespacePrefix, final Map<String, String> namespaceTagHints)
Parameters
parent:GPathResult

the GPathResult prior to the application of the expression creating this GPathResult

name:String

if the GPathResult corresponds to something with a name, e.g. a node

namespacePrefix:String

the namespace prefix if any

namespaceTagHints:Map<String, String>

the known tag to namespace mappings

NodeChildrenback to summary
public NodeChildren(final GPathResult parent, final String name, final Map<String, String> namespaceTagHints)
Parameters
parent:GPathResult

the GPathResult prior to the application of the expression creating this GPathResult

name:String

if the GPathResult corresponds to something with a name, e.g. a node

namespaceTagHints:Map<String, String>

the known tag to namespace mappings

NodeChildrenback to summary
public NodeChildren(final GPathResult parent, final Map<String, String> namespaceTagHints)
Parameters
parent:GPathResult

the GPathResult prior to the application of the expression creating this GPathResult

namespaceTagHints:Map<String, String>

the known tag to namespace mappings

Method Detail

appendNodeback to summary
protected void appendNode(final Object newValue)

Implements abstract groovy.xml.slurpersupport.GPathResult.appendNode.

buildback to summary
public void build(final GroovyObject builder)

Implements groovy.lang.Buildable.build.

childNodesback to summary
public Iterator<E> childNodes()

Implements abstract groovy.xml.slurpersupport.GPathResult.childNodes.

Doc from groovy.xml.slurpersupport.GPathResult.childNodes.

Returns an iterator over the child nodes of this GPathResult.

Returns:Iterator<E>

an iterator over the child nodes of this GPathResult

findback to summary
public GPathResult find(final Closure<V> closure)

Implements abstract groovy.xml.slurpersupport.GPathResult.find.

Doc from groovy.xml.slurpersupport.GPathResult.find.

Returns the first child of this GPathResult matching the condition(s) specified in the passed closure.

Parameters
closure:Closure<V>

a closure to filters the children of this GPathResult

Returns:GPathResult

the first child matching the closure

findAllback to summary
public GPathResult findAll(final Closure<V> closure)

Implements abstract groovy.xml.slurpersupport.GPathResult.findAll.

Doc from groovy.xml.slurpersupport.GPathResult.findAll.

Returns the children of this GPathResult matching the condition(s) specified in the passed closure.

Parameters
closure:Closure<V>

a closure to filters the children of this GPathResult

Returns:GPathResult

the children matching the closure

iteratorback to summary
public Iterator<E> iterator()

Implements abstract groovy.xml.slurpersupport.GPathResult.iterator.

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<E>

an Iterator.

nodeIteratorback to summary
public Iterator<E> nodeIterator()

Implements abstract groovy.xml.slurpersupport.GPathResult.nodeIterator.

parentsback to summary
public GPathResult parents()

Implements abstract groovy.xml.slurpersupport.GPathResult.parents.

Throws a GroovyRuntimeException, because it is not implemented yet.

Returns:GPathResult

Doc from groovy.xml.slurpersupport.GPathResult.parents.

the parents of this GPathResult

replaceBodyback to summary
protected void replaceBody(final Object newValue)

Implements abstract groovy.xml.slurpersupport.GPathResult.replaceBody.

replaceNodeback to summary
protected void replaceNode(final Closure<V> newValue)

Implements abstract groovy.xml.slurpersupport.GPathResult.replaceNode.

sizeback to summary
public synchronized int size()

Implements abstract groovy.xml.slurpersupport.GPathResult.size.

Doc from groovy.xml.slurpersupport.GPathResult.size.

Returns the size of this GPathResult.

Returns:int

the size of this GPathResult

textback to summary
public String text()

Implements abstract groovy.xml.slurpersupport.GPathResult.text.

Doc from groovy.xml.slurpersupport.GPathResult.text.

Returns the text of this GPathResult as a String.

Returns:String

the text of this GPathResult

writeToback to summary
public Writer writeTo(final Writer out) throws IOException

Implements groovy.lang.Writable.writeTo.

Doc from groovy.lang.Writable.writeTo.

Writes this object to the given writer.

This is used to defer content creation until the point when it is streamed to the output destination. Oftentimes, content will be defined but not necessarily created (as is may be the case with a Closure definition.) In that case, the output is then 'deferred' to the point when it is serialized to the writer. This class may be used whenever an object should be responsible for creating its own textual representation, but creating the entire output as a single String would be inefficient (such as outputting a multi-gigabyte XML document.)

Parameters
out:Writer

the Writer to which this Writable should output its data.

Returns:Writer

the Writer that was passed

Exceptions
IOException:
if an error occurred while outputting data to the writer