var $tree = '$this->ogg';
var $ogg ;
var $cnt = 0;
/************
* change_to_array
* is called by startElement
* to check if there is need
* to change element to array
************/
function change_to_array($test,$is_arr) {
if ($test and !$is_arr): //if element is set, change it to array
eval('$tmp = '.$this->tree.';'); //save element to tmp
eval('unset('.$this->tree.');'); //unset element
eval(''.$this->tree.'= array();'); //transform $this->tree in an array
eval('array_push('.$this->tree.',$tmp);');//push old object
//into the array
return true;
endif;
if ($is_arr)
return true;
}
/************
* startElement
************/
function startElement($parser, $name, $attrs)
{
$this->tree = $this->tree."->".$name; //add tag to tree string
//test if element is an array
eval('$is_arr = is_array('.$this->tree.');');
//test if element is set
eval('$test = isset('.$this->tree.');');
//if is already set (and not array)...
//...change it to array
$is_arr = $this->change_to_array($test,$is_arr);
if ($is_arr): //if is an array
$this->cnt = $this->cnt+1; //increase counter
//and set tree-string to add element
$this->tree = $this->tree.'['.$this->cnt.']';
endif;
return true;}
/************
* characterData
************/
function characterData($parser, $data)
{
if (trim($data)!=''):
$data = addslashes($data);
//add data to tree set up by startElement()
eval($this->tree."='".trim($data)."';");
endif;
return true;}