#40508 [Opn->Asn]: Namespace xpath doesn't work for nested elements
| From: | tony2001@php.net | Date: | Fri, 16 Feb 2007 20:44:31 +0000 |
| Subject: | #40508 [Opn->Asn]: Namespace xpath doesn't work for nested elements | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-109045@lists.php.net to get a copy of this message | ||
ID: 40508
Updated by: tony2001@php.net
Reported By: vrana@php.net
-Status: Open
+Status: Assigned
Bug Type: SimpleXML related
Operating System: Windows
PHP Version: 5.2.1
-Assigned To:
+Assigned To: helly
Previous Comments:
------------------------------------------------------------------------
[2007-02-16 13:21:46] vrana@php.net
Description:
------------
Registering XPath namespace works only for XPath queries from root
element.
Reproduce code:
---------------
$text = '<a xmlns="http://example.org"><b><c>test</c></b></a>';
$xml = simplexml_load_string($text);
// register in root
$xml->registerXPathNamespace("x", "http://example.org");
print_r($xml->b->xpath("x:c"));
// register in nested element
$xml->b->registerXPathNamespace("x", "http://example.org");
print_r($xml->b->xpath("x:c"));
Expected result:
----------------
At least once:
Array
(
[0] => SimpleXMLElement Object
(
[0] => test
)
)
Actual result:
--------------
Warning: SimpleXMLElement::xpath(): Undefined namespace prefix
Warning: SimpleXMLElement::xpath(): Undefined namespace prefix
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40508&edit=1