#43272 [Opn->Bgs]: getElementsByTagNameNS doen't find nodes
| From: | rrichards@php.net | Date: | Tue, 13 Nov 2007 10:39:08 +0000 |
| Subject: | #43272 [Opn->Bgs]: getElementsByTagNameNS doen't find nodes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-119590@lists.php.net to get a copy of this message | ||
ID: 43272
Updated by: rrichards@php.net
Reported By: jose dot rob dot jr at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: DOM XML related
Operating System: Gentoo Linux
PHP Version: 5.2.5
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
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
mixing level 1 (non-namespace aware) and level 2 methods
Previous Comments:
------------------------------------------------------------------------
[2007-11-13 00:33:56] jose dot rob dot jr at gmail dot com
Description:
------------
When I use a prefix, getElementsByTagNameNS doesn't find it until I
save and load again.
Reproduce code:
---------------
<?php
$xml=new DOMDocument();
$root=$xml->createElementNS('example','ex:root');
$xml->appendChild($root);
for($i=1;$i<=3;$i++){
$child=$xml->createElement("ex:child$i");
$root->appendChild($child);
}
for($i=0;$i<=1;$i++){
if($i){
echo "* reloading<br/>";
$XML=$xml->saveXML();
$xml->loadXML($XML);
}
$ns=$xml->getElementsByTagNameNS('example','*');
foreach($ns as $ex){
echo $ex->nodeName."<br/>";
}
}
?>
Expected result:
----------------
ex:root<br/>
ex:child1<br/>
ex:child2<br/>
ex:child3<br/>
* reloading<br/>
ex:root<br/>
ex:child1<br/>
ex:child2<br/>
ex:child3<br/>
Actual result:
--------------
ex:root<br/>
* reloading<br/>
ex:root<br/>
ex:child1<br/>
ex:child2<br/>
ex:child3<br/>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43272&edit=1