Example 4

Childs loop

Loop over the node's childs.

<?php

require 'CXml2Array.php';

$InName='test.xml';
if(!
$TplDom = domxml_open_file(realpath($InName)))
   
trigger_error('Error parsing the file ',E_USER_ERROR);

$root = $TplDom->document_element();
$x=new CXml2Array($root);
$menul=new CXml2Array($x->GetTagPos('menul',0));

echo
"Iterate over all node's child (child's value as object CXml2Array)<br>";
while((
$ret=$menul->EachChild())!=FALSE)
{
list(
$key,$value)=$ret;
echo
'<br>...key: '.$key.'<br>';
var_dump($value);
}
?>