Open Source Software Solutions

XMLConfigReader

XMLConfigReader is an open-source PHP5 class to read configuration data directly from an XML file.

XMLConfigReader reads resource text data directly from a XML file and store it on a bidimensional array. The first dimension keys are taken from the value of the id attribute of the <item> elements. The second dimension array keys are taken from the names of the sub-items tags. The values are taken from the content of sub-items tags.
Once the XML data importing process is completed, array elements could be normally accessed using keys and subkeys.

Example

// 1. include the XMLConfigReader class file in your project
require_once('XMLConfigReader.php');

// 2. istantiate new XMLConfigReader object reading the sample.xml file
$xmldata = new XMLConfigReader("sample.xml");

// 3. get resource array
$resource = $xmldata->getResource();

// 4. display some values
echo $resource['2']['name'];
echo $resource['2']['description'];

// 5. display the key for the specified element
echo $xmldata->getKey("description", "third element");

Documentation and examples are included on the distribution.

Download XMLConfigReader from SourceForge

Get XMLConfigReader - PHP version at SourceForge.net. Fast, secure and Free Open Source software downloadsSupport This Project

IT | EN
W3C XHTML 1.0 | W3C CSS 2.0