Attributes loop
Loop over the node's attribute.
<?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);
// Must load the element voc, it has some attribute
// voce is child of menul
// menul is child of root element
$menul=new CXml2Array($x->GetTagPos('menul',0));
$voce=new CXml2Array($menul->GetTagPos('voce')); // defualt return child 0
echo 'Iterate over all attributes<br>';
while(($ret=$voce->EachAttribute())!=FALSE)
{
list($key,$value)=$ret;
echo $key.'='.$value.'<br>';
}
?>
|