The XMLDOMNodeList Object

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 Allows random access to nodes in the collection

  • nextNode * Shows the next node in the collection

  • reset * Resets the list iterator

This object has no events.



Real World XML
Real World XML (2nd Edition)
ISBN: 0735712867
EAN: 2147483647
Year: 2005
Pages: 440
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net