Questo esempio mostra come verificare se un dato figlio esiste.
<?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);
// test the retrieve functions
echo 'Exist tag pippo ? '.(($x->ExistTag('pippo'))?'Y':'N').'<br>';
echo 'Exist tag menul ? '.(($x->ExistTag('menul'))?'Y':'N').'<br>';
?>
|