Bug #11903: xpath_eval does not work with default namespace.
| From: | peter at wingercom dot net | Date: | Thu, 05 Jul 2001 12:44:10 +0000 |
| Subject: | Bug #11903: xpath_eval does not work with default namespace. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-58987@lists.php.net to get a copy of this message | ||
From: peter@wingercom.net
Operating system: FreeBSD 4.3
PHP version: 4.0.6
PHP Bug Type: DOM XML related
Bug description: xpath_eval does not work with default namespace.
Hi, When using default namespace in the XML (XHTML) source
xpath_eval will not return any result except with the request "//*" whereby it will return
the whole XML source.
When making another namespace than "xmlns" everything works fine.
// The xpaht_eval() will NOT work with this line
$xhtml = '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>hummmm......</title></head><body></body></html>';
// The xpaht_eval() will work with this line
$xhtml = '<html BUGxmlns="http://www.w3.org/1999/xhtml"><head><title>hummmm......</title></head><body></body></html>';
$doc = xmldoc($xhtml);
$ctx = xpath_new_context($doc);
$node = xpath_eval_expression($ctx,"//title");
var_dump($node->nodeset);
--
Edit Bug report at: http://bugs.php.net/?id=11903&edit=1