--TEST--
SimpleXML: iteration through subnodes and attributes
--EXTENSIONS--
simplexml
--FILE--
Text1
Text2
Text3
EOF;
$xml1 =<<
EOF;
function traverse_xml($pad,$xml) {
foreach($xml->children() as $name => $node) {
echo $pad."<$name";
foreach($node->attributes() as $attr => $value) {
echo " $attr=\"$value\"";
}
echo ">\n";
traverse_xml($pad." ",$node);
echo $pad."$name>\n";
}
}
traverse_xml("",simplexml_load_string($xml));
echo "----------\n";
traverse_xml("",simplexml_load_string($xml1));
echo "---Done---\n";
?>
--EXPECT--
----------
---Done---