DOMIT! v 0.52 Tutorial
<<    index    >>
1    2    3    4    5    6    7    8    9    10    11    12    13    14    15    16    17   
18    19    20    21    22    23    24    25    26    27    28    29    30    31   
getElementsByTagName

The Document Object Model specifies a convenience method for obtaining a list of elements of the same name. The getElementsByTagName method of DOMIT_Document and DOMIT_Element returns this list as a DOMIT_NodeList.

NOTE: in versions of DOMIT! prior to 0.5, this method returned an array, not a DOMIT_NodeList!

If, for example,. we wished to get a list of our existing cd nodes, we could simply do:

$myCDNodeList =& $cdCollection->getElementsByTagName("cd");

We could then iterate through this array of cd nodes using the DOMIT_NodeList methods getLength and item:


$total = $myCDNodeList->getLength();

for ($i = 0; $i < $total; $i++) {
	$currNode =& $myCDNodeList->item($i);
	echo ($currNode->nodeName);
}


Documentation generated by ClassyDoc, using the DOMIT! and SAXY parsers.
Please visit Engage Interactive to download free copies.