#37622 [Fbk->Opn]: Odd DOMXPath->query behaviour

From: Date: Mon, 29 May 2006 09:09:49 +0000
Subject: #37622 [Fbk->Opn]: Odd DOMXPath->query behaviour
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97720@lists.php.net to get a copy of this message
ID: 37622 User updated by: nickm at tbms dot ru Reported By: nickm at tbms dot ru -Status: Feedback +Status: Open Bug Type: DOM XML related Operating System: Windows XP SP2 PHP Version: 5.1.4 New Comment: 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!"; } ?> Previous Comments: ------------------------------------------------------------------------ [2006-05-29 08:59:14] tony2001@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2006-05-29 08:47:11] 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/" &#1040;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! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37622&edit=1

« previous php.bugs (#97720) next »