php xpath查找所有相似的节点

php xpath查找所有相似的节点,php,xpath,Php,Xpath,我正在使用php xpath,并尝试获取xml中以scp:custom_标签开头的所有节点 我的xml是: <entry> <scp:availability>in stock</scp:availability> <scp:price unit='USD'>8.99</scp:price> <scp:custom_label_0>seasonal</scp:custom_label_0>

我正在使用php xpath,并尝试获取xml中以scp:custom_标签开头的所有节点

我的xml是:

<entry>
    <scp:availability>in stock</scp:availability>
    <scp:price unit='USD'>8.99</scp:price>
    <scp:custom_label_0>seasonal</scp:custom_label_0>
    <scp:custom_label_1>clearance</scp:custom_label_1>
    <scp:custom_label_2>holiday</scp:custom_label_2>
    <scp:custom_label_3>sale</scp:custom_label_3>
    <scp:custom_label_4>best seller</scp:custom_label_4>
</entry>
我没有得到任何结果

我希望$numEntries等于5

我感谢你的帮助。非常感谢

为此使用
local-name()

$res = $xpath->query("//*[contains(local-name(),'custom_label')]");
这对我有用

$xpath->query("//*[contains(local-name(),'custom_label')]");

谢谢你的时间和回答。这让我走上了正确的道路——你的XML规范很糟糕
应该是包含多个元素的标签。如果您接受另一个答案会更好,因为大部分答案都是直接从中获得的。
$xpath->query("//*[contains(local-name(),'custom_label')]");