#38850 [Opn->Fbk]: lookupNamespaceURI does not return default namespace
ID: 38850
Updated by: tony2001@php.net
Reported By: reanjr at reanjr dot org
-Status: Open
+Status: Feedback
Bug Type: XML related
Operating System: Win XP
PHP Version: 5.1.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2006-09-15 22:50:10] reanjr at reanjr dot org
Description:
------------
DOMNode->lookupNamespaceURI( prefix ) returns an empty string when
prefix is empty.
According XML DOM Level 3 spec, when passed a null value,
lookupNamespaceURI should return the default namespace for the node.
Reproduce code:
---------------
------------
test.xml
------------
<root xmlns="http://example.com/ns">
<!-- nothing to see here -->
</root>
------------
test.php
------------
$doc = DOMDocument::Load( 'test.xml' );
$node = $doc->documentElement;
$ns = $node->lookupNamespaceURI( null ); // or pass ''
echo( "namespace: $ns" );
Expected result:
----------------
Expected output
namespace: http://example.com/ns
Actual result:
--------------
Actual output
namespace:
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38850&edit=1
Thread (6 messages)