#47747 [Opn]: DOMAttr returns incomplete attribute name
| From: | mpeters at mac dot com | Date: | Sun, 22 Mar 2009 12:54:22 +0000 |
| Subject: | #47747 [Opn]: DOMAttr returns incomplete attribute name | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134990@lists.php.net to get a copy of this message | ||
ID: 47747
User updated by: mpeters at mac dot com
Reported By: mpeters at mac dot com
Status: Open
Bug Type: DOM XML related
Operating System: CentOS 5.2
PHP Version: 5.2.9
New Comment:
Full php demonstration -
The code that demonstrates:
http://www.clfsrpm.net/bugs/domattr.phps
Execution of code:
http://www.clfsrpm.net/bugs/domattr.php
Previous Comments:
------------------------------------------------------------------------
[2009-03-22 11:24:30] mpeters at mac dot com
Description:
------------
I'm using php 5.2.5 - upgrading is not possible. Sorry.
DOMattr->name does not include anything before a : nor provide a way to
access what was before a : in an attribute name.
Reproduce code:
---------------
Let's say $node refers to the following node -
<something xml:lang="en" foo="alpha" bar="beta" />
$attributes = $node->attributes;
foreach ($attributes as attribute) {
print ($attribute->name . "\n");
}
will result in
lang
foo
bar
notice the xml: is missing from before the lang.
DOMAttr provides no way to know that lang had a xml: before it.
However -
$node->hasAttribute('lang') is false while
$node->hasAttribute('xml:lang') is true
Expected result:
----------------
Either $DOMAttr->name
needs to provide the full attribute name including namespace or provide
a way to know what (if any) the namespace for the attribute name is.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47747&edit=1