Getting all nodes with the same name using xpath f

2020-05-02 08:12发布

问题:

This is my code:

$xml = file_get_contents('C:\myxml.xml');
$dom = new DOMDocument();
$dom->loadXML($xml);
$xpath = new DOMXPath($dom);
$xpath->registerNamespace("bme", "http://www.bmecat.org/bmecat/1.2/bmecat_new_catalog");

$expression = 'string(//bme:ARTICLE)';
var_dump($xpath->evaluate($expression));

This will var_dump the first of all the ARTICLE nodes. How can I get all of them?

Thanks for helping!

标签: php xpath