#43273 [Opn->Bgs]: getElementsByTagNameNS doen't find nodes

From: Date: Tue, 13 Nov 2007 10:37:23 +0000
Subject: #43273 [Opn->Bgs]: getElementsByTagNameNS doen't find nodes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-119589@lists.php.net to get a copy of this message
 ID:               43273
 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:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

dupe of bug #43273


Previous Comments:
------------------------------------------------------------------------

[2007-11-13 00:34:54] 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=43273&edit=1


Thread (2 messages)

« previous php.bugs (#119589) next »