#38850 [Opn->Fbk]: lookupNamespaceURI does not return default namespace

From: Date: Sat, 16 Sep 2006 14:09:29 +0000
Subject: #38850 [Opn->Fbk]: lookupNamespaceURI does not return default namespace
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-102277@lists.php.net to get a copy of this message
 ID:               38850
 Updated by:       rrichards@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 and 5.2
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.




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

[2006-09-16 00:21:22] reanjr at reanjr dot org

Relevent part of the XML DOM Level 3 spec:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI

------------------------------------------------------------------------

[2006-09-15 23:45:22] reanjr at reanjr dot org

Tried in 5.2 CVS release.  Same problem.

------------------------------------------------------------------------

[2006-09-15 23:07:20] tony2001@php.net

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



------------------------------------------------------------------------

[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)

« previous php.bugs (#102277) next »