The items in the NodeList
are accessible via an integral
* index, starting from 0.
*
*/
public class DOMNodeListImpl implements org.w3c.dom.NodeList {
private Node parent = null;
protected DOMNodeListImpl(Node parent)
{
this.parent = parent;
}
/**
* @see org.w3c.dom.NodeList#item
*/
public org.w3c.dom.Node item(int index)
{
int i = 0;
Node node = parent.content;
while (node != null) {
if (i >= index) break;
i++;
node = node.next;
}
if (node != null)
return node.getAdapter();
else
return null;
}
/**
* @see org.w3c.dom.NodeList#getLength
*/
public int getLength()
{
int len = 0;
Node node = parent.content;
while (node != null) {
len++;
node = node.next;
}
return len;
}
}