Example 2

Does exists the requested child?

This example shows how checks if the requested child exists.

<?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>';

?>