php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54382 DOMNode::getAttributeNodeNS doesn't get xmlns* attributes
Submitted: 2011-03-25 15:30 UTC Modified: -
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: koch at sevenval dot com Assigned:
Status: Closed Package: DOM XML related
PHP Version: 5.2.17 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: koch at sevenval dot com
New email:
PHP Version: OS:

 

 [2011-03-25 15:30 UTC] koch at sevenval dot com
Description:
------------
DOMNode's getAttributeNodeNS method does not return xmlns* nodes.

[test.xml]

<?xml version="1.0" encoding="utf-8" ?>
<root xmlns="http://ns" xmlns:ns2="http://ns2">
    <ns2:child />
</root>

getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "ns2") should return a node, as does getAttributeNode("xmlns:ns2").

Test script:
---------------
$xml=new DOMDocument();
$xml->load("test.xml");
$de = $xml->documentElement;
$ns2 = $de->getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "ns2");
if ($ns2 == NULL) {
  echo 'namespace node does not exist.' . "\n";
} else {
  echo 'namespace node prefix=' . $ns2->prefix . "\n";
  echo 'namespace node namespaceURI=' . $ns2->namespaceURI . "\n";
}


Expected result:
----------------
namespace node prefix=ns2
namespace node namespaceURI=http://ns2


Actual result:
--------------
namespace node does not exist.


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-25 21:00 UTC] krakjoe@php.net
Automatic comment on behalf of arnoutboks@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=721a189742acc6fb6c2c6d98ce86eebe4e34d42a
Log: Fix bug #54382 (getAttributeNodeNS doesn't get xmlns* attributes)
 [2017-01-25 21:00 UTC] krakjoe@php.net
-Status: Open +Status: Closed
 [2017-01-30 18:59 UTC] krakjoe@php.net
Automatic comment from SVN on behalf of krakjoe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=341824
Log: Documentation changes for bug #54382

--
Provided by anonymous 77704 (arnoutboks@gmail.com)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC