From fce6e8e4245b32a09d2dd0c7cd3a09a8b63b672a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 9 May 2005 23:46:59 +0000 Subject: [PATCH] Checking in the parser: - Doesn't work - Includes raw DEBUG data - Tag stack is operating weirdly - Need to fix before the next release --- xml.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/xml.php b/xml.php index fa275f8..b383c98 100644 --- a/xml.php +++ b/xml.php @@ -189,8 +189,13 @@ class XML_Parser array_walk($attributes, 'trim'); $this->attrdata[ $this->tagid ] = $attributes; + // our parent is the current element $this->parent = current($this->tree); - if ($this->parent === false) + + // add the current element onto the array + array_push($this->tree, $this->tagid); + + /*if ($this->parent === false) { $this->parent = -1; } @@ -198,7 +203,7 @@ class XML_Parser else { $this->parent++; - } + }*/ // initialize the data set $this->taginfo["$name"][ $this->parent ][ $this->tagid ] = ''; @@ -216,19 +221,11 @@ class XML_Parser function _cdata($parser, $data) { // read in the CDATA - if ($this->parent == $this->tagid) + if ($this->parent == $this->tagid AND !isset($this->taginfo[ $this->tagname ][ $this->parent ][ $this->tagid ])) { - if (!isset($this->taginfo[ $this->tagname ][ $this->parent ][ $this->tagid ])) - { - $this->taginfo[ $this->tagname ][ $this->parent ][ $this->tagid ] = ''; - } - - $this->taginfo[ $this->tagname ][ $this->parent ][ $this->tagid ] .= $data; - } - else - { - $this->taginfo[ $this->tagname ][ $this->parent ][ $this->tagid ] .= $data; + $this->taginfo[ $this->tagname ][ $this->parent ][ $this->tagid ] = ''; } + $this->taginfo[ $this->tagname ][ $this->parent ][ $this->tagid ] .= $data; } /** @@ -239,6 +236,10 @@ 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); } -- 2.43.5