xmlArray

Class xmlArray Represents an XML array
Methods Summary
public
# __construct( string $data , bool $auto_trim = false, int $level = NULL, bool $is_clone = false )
Constructor for the xml parser. Example use: $xml = new xmlArray(file('data.xml'));
public
# name( )
Get the root element's name. Example use: echo $element->name();
public
# fetch( string $path , bool $get_elements = false )
Get a specified element's value or attribute by path. Children are parsed for text, but only textual data is returned unless get_elements is true. Example use: $data = $xml->fetch('html/head/title');
public
# path( $path , $return_full = false )
Get an element, returns a new xmlArray. It finds any elements that match the path specified. It will always return a set if there is more than one of the element or return_set is true. Example use: $element = $xml->path('html/body');
public
# exists( string $path )
Check if an element exists. Example use, echo $xml->exists('html/body') ? 'y' : 'n';
public
# count( string $path )
Count the number of occurrences of a path. Example use: echo $xml->count('html/head/meta');
public
# set( $path )
Get an array of xmlArray's matching the specified path. This differs from ->path(path, true) in that instead of an xmlArray of elements, an array of xmlArray's is returned for use with foreach. Example use: foreach ($xml->set('html/body/p') as $p)
public
# create_xml( string $path = NULL )
Create an xml file from an xmlArray, the specified path if any. Example use: echo $this->create_xml();
public
# to_array( string $path = NULL )
Output the xml in an array form. Example use: print_r($xml->to_array());
protected
# _parse( string $data )
Parse data into an array. (privately used. ..)
protected
# _xml( array $array , null|int $indent )
Get a specific element's xml. (privately used. ..)
protected
# _array( array $array )
Return an element as an array
public
# _to_cdata( string $data )
Parse out CDATA tags. (htmlspecialchars them. ..)
protected
# _from_cdata( string $data )
Turn the CDATAs back to normal text.
protected
# _fetch( array $array )
Given an array, return the text from that array. (recursive and privately used.)
protected
# _path( array $array , string $path , int $level , bool $no_error = false )
Get a specific array by path, one level down. (privately used. ..)
Properties Summary
public array $array
# NULL
public int $debug_level
# NULL
public bool $trim
holds trim level textual data
# NULL