<?php
/*
* Class to read XML file
* Class use SimpleXml - default PHP class
* @package Xml2Array
* @date 2005-07-29
*/
require("Xml2Array.class.php");
try {
$Xml2Array = new Xml2Array("test.xml");
$xpathElement5 = "data/element1/element2/element3/element4/element5";
$element5 = $Xml2Array->$xpathElement5;
echo $element5;
}
catch (Exception $e) {
echo "<hr />";
echo "Exception code: <font style='color:blue'>". $e->getCode() ."</font>";
echo "<br />";
echo "Exception message: <font style='color:blue'>". nl2br($e->getMessage()) ."</font>";
echo "<br />";
echo "Thrown by: '". $e->getFile() ."'";
echo "<br />";
echo "on line: '". $e->getLine() ."'.";
echo "<br />";
echo "<br />";
echo "Stack trace:";
echo "<br />";
echo nl2br($e->getTraceAsString());
echo "<hr />";
}
?>
|