PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of Andrioli Darvin   Xml2Array   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Class documentation
Class: Xml2Array
The class parse an XML file and load it
Author: By
Last change: Added notes about the new release
Date: 20 years ago
Size: 1,564 bytes
 

Contents

Class file image Download
CXml2Array version 1.1 27/02/2004 Description: ---------------------- The class is meant to parse an XML file and load it into an array. The module uses the DOMXML functions to parse the tag's values, the tag's attribute, the external entity and CDATA section. Also the class provides some functions to retrieve all or part of the array made from the XML file. Installation: ---------------------- PHP => 4.3.0 - I've test the class using PHP 4.3.0 and PHP 4.3.1. I think the class should work with PHP 4.2.x. The DOMXML extension enabled (see PHP manual how to enable it) Usage: ---------------------- // Here the code to run the class 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); $ArrayXml=x->GetArray(); // if you want see the array contents, use $x->ArrayDump(); See test1.php to get more complete information about the usage visit my site http://www.andrioli.com/en/php.html ChangeLog: ---------------------- 1.1 - 27/2/2004 * Changed, now the child's tag are retrieved in the same order they are in the XML file * Changed, the text inside the tag are 'right-trimmed' in order to maintain the left spaces * New, new functions: GetText, GetTagName, EachChild, EachChildArray 1.0 - 15/12/2003 * First public release That's all. I hope it be useful. Darvin (darvin at andrioli dot com)