Team LiB
Previous Section Next Section

NodeListorg.w3c.dom

Java 1.4

This interface represents a read-only ordered collection of nodes that can be interated through. getLength( ) returns the number of nodes in the list, and item( ) returns the Node at a specified index in the list (the index of the first node is 0). The elements of a NodeList are always valid Node objects: a NodeList never contains null elements.

Note that NodeList objects are "live"they are not static but immediately reflect changes to the document tree. For example, if you have a NodeList that represents the children of a specific node, and you then delete one of those children, the child will be removed from your NodeList. Be careful when looping through the elements of a NodeList if the body of your loop makes changes to the document tree (such as deleting nodes) that may affect the contents of the NodeList!

public interface NodeList {
// Public Instance Methods
     int getLength( );  
     Node item(int index);  
}

Returned By

Document.{getElementsByTagName( ), getElementsByTagNameNS( )}, Element.{getElementsByTagName( ), getElementsByTagNameNS( )}, Node.getChildNodes( )

    Team LiB
    Previous Section Next Section