Node lists

Some of the operations described above return lists of nodes that match some criteria. For example, getElementsByTagName returns all the element nodes that have a given name, and getChildNodes returns all the children of a given node. For convenience, a single NodeList object is returned. This object acts as a wrapper for the returned nodes. The nodes contained in this object are organized into a logical, linear sequence. For example, the getChildNodes method returns all the children nodes, in their original order of appearance, so that they can be easily processed in correct document order. The NodeList interface defines the following two methods:

Node  item(int index);
int   getLength( );

Get node from list

A reference to a node ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.