From:             [EMAIL PROTECTED]
Operating system: Linux 2.2.16-3 (RH)
PHP version:      4.0.4pl1
PHP Bug Type:     DOM XML related
Bug description:  wrong xml node content

Element nodes contain the wrong content

When I loop through all the children of the node "root" of the following xml then the 
fourth child (second <my>)contains ($node->content) 
"2<newline><newline>3<newline><newline>" which should be nothing since its empty.
When I examine the output of a domxml_dumpmem dump of the $xml variable it does 
contain the correct data.
Libxml version is 2.3.2

xml:
<?xml version="1.0"?>
<root>
<my>1</my>
<my/>
<my>2</my>
<my/>
<my>3</my>
</root>

output of my script:
idx=0 name=text content=

idx=1 name=my content=1
idx=2 name=text content=

idx=3 name=my content=
2

3

idx=4 name=text content=

idx=5 name=my content=2
idx=6 name=text content=

idx=7 name=my content=
3

idx=8 name=text content=

idx=9 name=my content=3
idx=10 name=text content=
end of output


my script:
<?php

$txt  = "<?xml version=\"1.0\"?>\n";
$txt .= "<root>\n";
$txt .= "<my>1</my>\n";
$txt .= "<my/>\n";
$txt .= "<my>2</my>\n";
$txt .= "<my/>\n";
$txt .= "<my>3</my>\n";
$txt .= "</root>\n";

$xml = xmldoc($txt);

$root = $xml->children();

$children = $root[0]->children();

echo "<pre>\n";
for($i=0; $i < count($children); $i++) {
        echo "idx=$i name=" . $children[$i]->name;
        echo " content=" . $children[$i]->content;
        echo "\n";
}
echo "</pre>\n";
?>


-- 
Edit Bug report at: http://bugs.php.net/?id=9740&edit=1



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to