#39505 [NEW]: xpath query failed if root element has xmlns attribute
| From: | sghnqk at gmail dot com | Date: | Mon, 13 Nov 2006 19:08:15 +0000 |
| Subject: | #39505 [NEW]: xpath query failed if root element has xmlns attribute | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-104927@lists.php.net to get a copy of this message | ||
From: sghnqk at gmail dot com
Operating system: linux
PHP version: 5.2.0
PHP Bug Type: DOM XML related
Bug description: xpath query failed if root element has xmlns attribute
Description:
------------
according to http://www.w3.org/TR/REC-xml-names/ ,
both
<root xmlns="...">
and
<root xmlns:ns="...">
are valid,
xpath->query() will fail with the first case.
Reproduce code:
---------------
<?php
$xml=<<<end
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<child />
</root>
end;
$doc=new DomDocument();
$doc->loadXML($xml);
$xpath=new DomXpath($doc);
$query='/root';
$result=$xpath->query($query);
echo $result->length;
Expected result:
----------------
string '1'
Actual result:
--------------
string '0'
--
Edit bug report at http://bugs.php.net/?id=39505&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39505&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39505&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39505&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39505&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=39505&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39505&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39505&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39505&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39505&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39505&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=39505&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=39505&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39505&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39505&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39505&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39505&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39505&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39505&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39505&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39505&r=mysqlcfg