I am currently working on a plugin page that automatically pulls information from an XML file using SOAP/WSDL.

I have no problem making the call and getting the data, however I have run into the following issue and I'm stuck:

I am looping through the data on the XML file using a while loop, but I must assign a set number of times to loop.. I cannot find a way to get the number of elements with success.

PHP Code:

= new DOMDocument();


while (
$i<100) {
$element[$i] = $dom->getElementsByTagName('element')->item($i)->nodeValue;

At this point, the data is put into an array for later use. Using this method, I am able to pull all the data from the XML file, however the number of elements contained in the file change regularly. I have attempted the following to get a count of the elements:

PHP Code:
    $CountVar $dom->getElementsByTagName('element');
However, the result is 1. Through experimentation, I found this:

PHP Code:
$CountVar $dom->getElementsByTagName('element1');
The result is again 1. I can keep going with the numbers after "element" and continue to get the same result of 1 until the XML document runs out of data.

I've been through the PHP documentation and I couldn't find anything in regard to this type of issue... can anyone please steer me in the right direction to finding a count?