Assume an XML file that looks like:

<catalog>
 <cd>
  ..
 </cd>
 <cd>
  ..
 </cd>
 ..
</catalog>

... and that I would like to know the number of CDs. An xpath expression would look like count(/catalog/cd), but how do I run this expression?

$dom = new DOMDocument();
$dom->load("catalog.xml");
$xpath = new DOMXpath($dom);
var_dump($xpath->query("count(/catalog/cd")->item(0));

... returns NULL.

Any ideas?

Thanks in advance,
Victor

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to