org.codehaus.cargo.module.internal.util.xml
Class AbstractNodeList

java.lang.Object
  extended by org.codehaus.cargo.module.internal.util.xml.AbstractNodeList
All Implemented Interfaces:
org.w3c.dom.NodeList
Direct Known Subclasses:
TagNodeList

public abstract class AbstractNodeList
extends java.lang.Object
implements org.w3c.dom.NodeList

Wrapped NodeList that provides accessors and iterators.

Version:
$Id: $

Field Summary
protected  org.w3c.dom.NodeList nodeList
          The wrapped nodelist.
protected  org.w3c.dom.Element rootElement
          The root (parent) element for all of the nodes in the list.
 
Constructor Summary
AbstractNodeList(org.w3c.dom.Element rootElement, org.w3c.dom.NodeList nodeList)
          Constructor.
 
Method Summary
 void add(org.w3c.dom.Element item)
          Add an item to the list.
 AbstractElement getByElementId(java.lang.String name)
          Get an element by comparing the provided name to each element in turn.
 int getLength()
          
abstract  org.w3c.dom.Node item(int index)
          
 java.util.Iterator iterator()
          Create an iterator over the list.
 void remove(org.w3c.dom.Element item)
          Remove an item from the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeList

protected org.w3c.dom.NodeList nodeList
The wrapped nodelist.


rootElement

protected org.w3c.dom.Element rootElement
The root (parent) element for all of the nodes in the list.

Constructor Detail

AbstractNodeList

public AbstractNodeList(org.w3c.dom.Element rootElement,
                        org.w3c.dom.NodeList nodeList)
Constructor. Create a wrapped nodelist

Parameters:
rootElement - the root element of all the nodelist items
nodeList - the nodelist to wrap
Method Detail

item

public abstract org.w3c.dom.Node item(int index)

Specified by:
item in interface org.w3c.dom.NodeList
See Also:
NodeList.item(int)

getLength

public int getLength()

Specified by:
getLength in interface org.w3c.dom.NodeList
See Also:
NodeList.getLength()

iterator

public java.util.Iterator iterator()
Create an iterator over the list.

Returns:
the iterator

getByElementId

public AbstractElement getByElementId(java.lang.String name)
Get an element by comparing the provided name to each element in turn.

Parameters:
name - in the name of the element
Returns:
the found element, or null if not found

add

public void add(org.w3c.dom.Element item)
Add an item to the list.

Parameters:
item - in the item to add

remove

public void remove(org.w3c.dom.Element item)
Remove an item from the list.

Parameters:
item - in the item to remove


Copyright © 2004-2010 Codehaus. All Rights Reserved.