ID:               42829
 Updated by:       [EMAIL PROTECTED]
 Reported By:      keith at blacknight dot ie
-Status:           Open
+Status:           Bogus
 Bug Type:         SimpleXML related
 Operating System: Ubuntu 7.04
 PHP Version:      5.2.4
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Unprefixed attributes have no namespace so its up to the application to
determine what the attribute means in context of the element.


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

[2007-10-02 12:56:06] keith at blacknight dot ie

Description:
------------
According to "Namespaces in XML 1.0 (Second Edition)", SS6.2:

"A default namespace declaration applies to all unprefixed element
names within its scope. Default namespace declarations do not apply
directly to attribute names; the interpretation of unprefixed attributes
is determined by the element on which they appear."

However, SimpleXML appears to treat unprefixed attributes as in the
default namespace. This is incorrect.

Reproduce code:
---------------
<?php
$doc1 = <<<LEFIN
<foo:bar xmlns:foo="urn:1">
    <foo:baz fred="barney"/>
</foo:bar>
LEFIN;

$doc2 = <<<LEFIN
<foo:bar xmlns:foo="urn:1">
    <foo:baz foo:fred="barney"/>
</foo:bar>
LEFIN;

$kids1 = simplexml_load_string($doc1)->children('urn:1');
$kids2 = simplexml_load_string($doc2)->children('urn:1');

print_r($kids1);
print_r($kids2);


Expected result:
----------------
SimpleXMLElement Object
(
    [baz] => SimpleXMLElement Object
        (
            [EMAIL PROTECTED] => Array
                (
                    [fred] => barney
                )

        )

)
SimpleXMLElement Object
(
    [baz] => SimpleXMLElement Object
        (
            [EMAIL PROTECTED] => Array
                (
                    [fred] => barney
                )

        )

)


Actual result:
--------------
SimpleXMLElement Object
(
    [baz] => SimpleXMLElement Object
        (
        )

)
SimpleXMLElement Object
(
    [baz] => SimpleXMLElement Object
        (
            [EMAIL PROTECTED] => Array
                (
                    [fred] => barney
                )

        )

)



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


-- 
Edit this bug report at http://bugs.php.net/?id=42829&edit=1

Reply via email to