Zeile 16 | Zeile 16 |
---|
class XMLParser {
|
class XMLParser {
|
| /** * @var string */
|
public $data;
|
public $data;
|
| /** * @var array */
|
public $vals;
|
public $vals;
|
| /** * @var int */
|
public $collapse_dups = 1;
|
public $collapse_dups = 1;
|
| /** * @var int */
|
public $index_numeric = 0;
/** * Initialize the parser and store the XML data to be parsed.
|
public $index_numeric = 0;
/** * Initialize the parser and store the XML data to be parsed.
|
| * * @param string $data
|
*/ function __construct($data) {
| */ function __construct($data) {
|
Zeile 51 | Zeile 65 |
---|
/** * Private: Build a completed tag by fetching all child nodes and attributes *
|
/** * Private: Build a completed tag by fetching all child nodes and attributes *
|
* @param array Array of values from the current tag * @param array Array of child nodes * @param int Internal counter * @param string Type of tag. Complete is a single line tag with attributes
| * @param array $thisvals Array of values from the current tag * @param array $vals Array of child nodes * @param int $i Internal counter * @param string $type Type of tag. Complete is a single line tag with attributes
|
* @return array Completed tag array */ function build_tag($thisvals, $vals, &$i, $type)
| * @return array Completed tag array */ function build_tag($thisvals, $vals, &$i, $type)
|
Zeile 83 | Zeile 97 |
---|
/** * Fetch the children for from a specific node array *
|
/** * Fetch the children for from a specific node array *
|
* @param array Array of children * @param int Internal counter
| * @param array $vals Array of children * @param int $i Internal counter
|
* @return array Array of child nodes */
|
* @return array Array of child nodes */
|
function get_children($vals, &$i)
| function get_children($vals=array(), &$i)
|
{ $children = array();
| { $children = array();
|
Zeile 138 | Zeile 152 |
---|
/** * Kill off unnecessary tags and return a clean array of XML data *
|
/** * Kill off unnecessary tags and return a clean array of XML data *
|
* @param array Array of parsed XML data
| * @param array $array Array of parsed XML data
|
* @return array Cleaned array of XML data */ function kill_tags($array)
| * @return array Cleaned array of XML data */ function kill_tags($array)
|
Zeile 157 | Zeile 171 |
---|
// if the array no longer has any key/val sets // and therefore is at the deepest level, then // store the string value
|
// if the array no longer has any key/val sets // and therefore is at the deepest level, then // store the string value
|
if(count($array[$key]) <= 0)
| if(is_array($array[$key]) && count($array[$key]) <= 0)
|
{ $array[$key] = $val['value']; }
| { $array[$key] = $val['value']; }
|