|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-03-22 11:24 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 14:00:01 2025 UTC |
you have to use the NS aware functions like setAttributeNS to get the correct behaivour, eg: $tag- >setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:lang","en");