From c881e8c0be3bf3e5895365b9e58f0925c5fe1592 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 10 May 2005 02:39:18 +0000 Subject: [PATCH] Fixed the XML parser so it actually works now... how exciting! --- xml.php | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/xml.php b/xml.php index b383c98..3e7f7f5 100644 --- a/xml.php +++ b/xml.php @@ -189,27 +189,18 @@ class XML_Parser array_walk($attributes, 'trim'); $this->attrdata[ $this->tagid ] = $attributes; - // our parent is the current element + // refocus the array + end($this->tree); + + // calculate the parent $this->parent = current($this->tree); + $this->parent = (($this->parent === false) ? -1 : $this->parent); // add the current element onto the array array_push($this->tree, $this->tagid); - /*if ($this->parent === false) - { - $this->parent = -1; - } - // advance the parent counter because the tree is yet to be updated - else - { - $this->parent++; - }*/ - // initialize the data set $this->taginfo["$name"][ $this->parent ][ $this->tagid ] = ''; - - // add the current tag into the tree - $this->tree[] = $this->tagid; } /** @@ -237,11 +228,7 @@ class XML_Parser function _tag_end($parser, $name) { // pop off the end element - var_dump(array_pop($this->tree)); - var_dump($this->tree); - - // make sure that we're always at the end of the tree - end($this->tree); + array_pop($this->tree); } } -- 2.43.5