ID: 9740
Updated by: joey
Old Status: Open
Status: Closed
Bug Type: DOM XML related
Operating System: Linux 2.2.16-3 (RH)
PHP Version: 4.0.4pl1
New Comment:

Closed in CVS, fix will be part of 4.0.7.

Previous Comments:

[2001-03-14 09:54:05] [EMAIL PROTECTED]

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 version="1.0"?>

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=


idx=4 name=text content=

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

idx=7 name=my content=

idx=8 name=text content=

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

my script:

$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 this bug report at

PHP Development Mailing List <>
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