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.

Warning! In versions of DOMIT! prior to 0.5, this method returned an array, not a DOMIT_NodeList! Please modify any old code accordingly.

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.