ID:               31409
 Updated by:       [EMAIL PROTECTED]
 Reported By:      joern_h at gmx dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         XML related
 Operating System: Windows 2000
 PHP Version:      5.0.3
 New Comment:

This is a bug in libxml not PHP. issue being addressed there.
For workaround use full open and closing tags for empty elements
defining namespaces:
<test xmlns="http://t/";></test>


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

[2005-01-04 19:01:32] joern_h at gmx dot net

Description:
------------
When an empty element is has a xmlns attribute the element following it
is also reported to be in this namespace. In the following example the
'a' element is wrongly reported as being in the 'http://t/' namespace.

Reproduce code:
---------------
<?php

$xml = <<<HERE
<?xml version="1.0" encoding="utf-8" ?>
<root>
    <test xmlns="http://t/"; />
    <a />
</root>
HERE;

$parser =& xml_parser_create_ns('utf-8', ';');
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, true);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);

$index = array();
$vals  = array();
if (!xml_parse_into_struct($parser, $xml, $vals, $index)) {
    echo xml_error_string(xml_get_error_code($parser)) . "\n";
}
print_r($vals);

xml_parser_free($parser);

?>

Expected result:
----------------
Array
(
    [0] => Array
        (
            [tag] => root
            [type] => open
            [level] => 1
        )

    [1] => Array
        (
            [tag] => http://t/;test
            [type] => complete
            [level] => 2
        )

    [2] => Array
        (
            [tag] => a
            [type] => complete
            [level] => 2
        )

    [3] => Array
        (
            [tag] => root
            [type] => close
            [level] => 1
        )

)

Actual result:
--------------
Array
(
    [0] => Array
        (
            [tag] => root
            [type] => open
            [level] => 1
        )

    [1] => Array
        (
            [tag] => http://t/;test
            [type] => complete
            [level] => 2
        )

    [2] => Array
        (
            [tag] => http://t/;a
            [type] => complete
            [level] => 2
        )

    [3] => Array
        (
            [tag] => root
            [type] => close
            [level] => 1
        )

)


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


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

Reply via email to