Ask a Question related to PHP Bugs, Design and Development.
-
sghnqk at gmail dot com #1
#39505 [NEW]: xpath query failed if root element has xmlns attribute
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 [url]http://www.w3.org/TR/REC-xml-names/[/url] ,
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 [url]http://bugs.php.net/?id=39505&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=39505&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=39505&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=39505&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=39505&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=39505&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=39505&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=39505&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=39505&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=39505&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=39505&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=39505&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=39505&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=39505&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=39505&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=39505&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=39505&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=39505&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=39505&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=39505&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=39505&r=mysqlcfg[/url]
sghnqk at gmail dot com Guest
-
#38949 [NEW]: Cannot get xmlns value attribute
From: superruzafa at gmail dot com Operating system: Windows XP PHP version: 5.1.6 PHP Bug Type: DOM XML related Bug... -
xmlns attribute
I am returning xml from a web service. When I look at the response, I notice that the root element has xmlns="". Why is this and how do I correct... -
Retrieving XML attribute using XML::XPath::Node::Attribute
Hi I am trying to retrieve an attribute of a particular node from my XML using "XML::XPath::Node::Attribute", but couldn't come across on how to... -
How to specify xpath path to createNode to force element position
Is it possible to specify a path to createNode that would cause a new element to appear after the first execute but before the queryset element? ... -
xpath - how to find a node where a specific attribute does NOT exist?
Hi, since there doesn't appear to be a way to get the individual elements that make up the xpath to a result node, I'm trying to create an xpath... -
rrichards@php.net #2
#39505 [Opn->Bgs]: xpath query failed if root element has xmlns attribute
ID: 39505
Updated by: [email]rrichards@php.net[/email]
Reported By: sghnqk at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: DOM XML related
Operating System: linux
PHP Version: 5.2.0
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]
first case is correct - xpath is namespace aware and root in def ns.
Previous Comments:
------------------------------------------------------------------------
[2006-11-13 19:08:15] sghnqk at gmail dot com
Description:
------------
according to [url]http://www.w3.org/TR/REC-xml-names/[/url] ,
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 this bug report at [url]http://bugs.php.net/?id=39505&edit=1[/url]
rrichards@php.net Guest



Reply With Quote

