2004-01-23 05:55:09 +08:00
|
|
|
--TEST--
|
2005-11-29 10:51:07 +08:00
|
|
|
Bug #27010 (segfault and node text not displayed when returned from children())
|
2005-12-21 19:42:06 +08:00
|
|
|
--SKIPIF--
|
|
|
|
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
|
2004-01-23 05:55:09 +08:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$xml=<<<EOF
|
|
|
|
<drinks xmlns:hot="http://www.example.com/hot">
|
|
|
|
<hot:drink><hot:name>Coffee</hot:name></hot:drink>
|
|
|
|
<hot:drink><hot:name>Tea</hot:name></hot:drink>
|
|
|
|
<drink><name>Cola</name></drink>
|
|
|
|
<drink><name>Juice</name></drink>
|
|
|
|
</drinks>
|
|
|
|
EOF;
|
|
|
|
|
|
|
|
$sxe = simplexml_load_string($xml);
|
|
|
|
|
|
|
|
foreach ($sxe as $element_name => $element) {
|
|
|
|
print "$element_name is $element->name\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($sxe->children('http://www.example.com/hot') as $element_name => $element) {
|
|
|
|
print "$element_name is $element->name\n";
|
|
|
|
}
|
2004-02-11 20:19:26 +08:00
|
|
|
|
2004-01-23 05:55:09 +08:00
|
|
|
?>
|
|
|
|
===DONE===
|
|
|
|
--EXPECT--
|
|
|
|
drink is Cola
|
|
|
|
drink is Juice
|
|
|
|
drink is Coffee
|
|
|
|
drink is Tea
|
|
|
|
===DONE===
|