PHP Classes

File: ___case_of_use.php

Recommend this page to a friend!
  Classes of Michal Palma   XML 2 Array   ___case_of_use.php   Download  
File: ___case_of_use.php
Role: Example script
Content type: text/plain
Description: Cases of use
Class: XML 2 Array
Parse an XML document into an array XPATH indexed
Author: By
Last change: Little mistake
Date: 19 years ago
Size: 888 bytes
 

Contents

Class file image Download
<?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 />";
}


?>