ID:               47747
 Updated by:       [email protected]
 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:

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";);






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

[2009-03-22 12:54:22] mpeters at mac dot com

Full php demonstration -

The code that demonstrates:

http://www.clfsrpm.net/bugs/domattr.phps

Execution of code:

http://www.clfsrpm.net/bugs/domattr.php

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

[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

Reply via email to