<?php 
include('xmlAccess.inc'); 
 
//Loading XML file 
$xml = new XMLAccess('example.xml'); 
 
//Get information at tag's attributes 
echo $xml->getAttributeValueFromTagName('my-info', 'name') . '<br>'; 
echo $xml->getAttributeValueFromTagName('my-info', 'email') . '<br><br>'; 
 
//Another way to get that information 
$node = $xml->getNodeByTagName('my-info'); 
echo $xml->getAttributeValueFromNode($node, 'name') . '<br>'; 
echo $xml->getAttributeValueFromNode($node, 'email') . '<br><br>'; 
 
//Other methods 
$other_node = $xml->getNodeByAttribute('tag-attr'); 
echo $xml->getAttributeValueFromNode($other_node, 'tag-attr') . '<br><br>'; 
 
//Another way to find my email information 
$my_node = $xml->getNodeByAttribute('name', 'Tiago Wust Freres'); 
echo $xml->getAttributeValueFromNode($my_node, 'email') . '<br><br>'; 
 
//Receiving more then one result 
echo '<pre>'; 
print_r($xml->getAttributeValueFromTagName('tag', 'attr1')); 
echo '</pre>'; 
?>
 
 |