Skip to Content
Real World XML
book

Real World XML

by Steven Holzner
January 2003
Beginner to intermediate content levelBeginner to intermediate
1200 pages
23h 42m
English
Peachpit Press
Content preview from Real World XML

The XMLDOMNodeList Object

You use the XMLDOMNodeList to handle lists of nodes, and node lists are useful because a node can itself have many child nodes. Using a node list, you can handle all the children of a node at once.

For example, here I'm loading a document and getting a list of all <PERSON> elements as a node list, using the document object's getElementsByTagName method:

function readXMLDocument() 
{
    var xmldoc, nodeList
    xmldoc = new ActiveXObject("Microsoft.XMLDOM")
    xmldoc.load("ch07_01.xml")
    nodeList = xmlDoc.getElementsByTagName("PERSON")
    .
    .
    .

Here is the base set of properties for the XMLDOMNodeList object:

  • length— Number of items in the collection. Read-only.

Here is the base set of methods for the XMLDOMNodeList object:

  • item

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Inside XML

Inside XML

Steven Holzner
XML Hacks

XML Hacks

Michael Fitzgerald

Publisher Resources

ISBN: 0735712867Purchase book