New here? Register and read our Community Rules. Accounts are approved by hand.
XPath problem in PHP
I am using XPath in PHP to search for 1 information. Every XPath test tool can find the information with that XPath Query. However, PHP doesn't deliver it. Anyone know what's the problem?
Thanks
Here is the XML Source: http://pastebin.com/8ykGpASr
And here is my PHP code for Xpath
$xml = new SimpleXMLElement($html); $xml->registerXPathNamespace('ssopenurl', 'http://xml.serialssolutions.com/ns/openurl/v1.0'); $url = $xml->xpath('//ssopenurl:url[@type="article"]'); var_dump($url);
0

Comments
What does xpath() return? An empty array or false? I tried it and it returns an array with one element.
Same here, you probably messed up somewhere before, check if $html is really what's it supposed to be.
If I search for other node, it will return fine.
Oops. Yes. You are right. $html is not what I though they should be.