|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-05-29 08:47 UTC] nickm at tbms dot ru
Description: ------------ I've tried to execute the "/gesmes:Envelope/:Cube/:Cube/:Cube[@currency='USD']" XPath instruction via the DOMXPath->query method on the "http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml" but I got neither parse error nor the DOMNodeList. The result is simply empty. I validated my istruction here: "http://www.activsoftware.com/xml/xpath/" Аnd it get exactly what I want from the XML document. Reproduce code: --------------- $from = "USD"; $result = $xPath->query("/gesmes:Envelope/:Cube/:Cube/:Cube[@currency='" . strtoupper($from) . "']"); //$result is EMPTY! PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 16:00:01 2025 UTC |
Here is the code: <? $document = new DOMDocument("1.0", "utf-8"); $document->load("http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml"); $xPath = new DOMXPath($document); $result = $xPath->query("/gesmes:Envelope/:Cube/:Cube/:Cube[@currency='USD']"); //Oops! $result is somehow empty if ($result->length > 0) { print "OK!"; } else { print "ERROR!"; } ?>