I've narrowed down my problem...  It is building the array as it 
should.  I can print_r the results in the function CData().  However, 
the results are no longer then at the end of GetArray().  I'm not sure 
what's causing this problem...



<? 


        class eXML
        {


                var $Parser;

                var $theArray;
                var $theArrayTopElement;
                var $theArrayElements;
                var $theArrayPointer;
                var $theArrayGetElement;


                function eXML($_PARENT_, $_CHILDREN_)
                {

                        $this->Parser = xml_parser_create("ISO-8859-1");
                        xml_set_object($this->Parser, &$this);
                        xml_set_element_handler($this-
>Parser, "Tag_Open", "Tag_Close");
                        xml_set_character_data_handler($this-
>Parser, "CData");

                        $this->theArray = array();
                        $this->theArrayPointer = 0;
                        $this->theArrayGetElement = NULL;
                        $this->theArrayTopElement = $_PARENT_;
                        $this->theArrayElements = $_CHILDREN_;

                }


                function Free()
                {

                        xml_parser_free($this->Parser);

                }


                function GetArray($_FILE_)
                {

                        $_FP_ = fopen($_FILE_, "r") or die("Cannot Open 
XML Stream");

                        while ($_DATA_ = fread($_FP_, 4096))
                        {

                                if (!xml_parse($this->Parser, $_DATA_, 
feof($_FP_)))
                                {

                                        return(FALSE);

                                }

                        }

                        fclose($_FP_);

                        //print_r($this->theArray);    <~~ shows empty 
array
                        return($this->theArray);

                }


                function Tag_Open($_PARSER_, $_TAG_, $_ATTR_)
                {

                        $_ELEMENTS_ = explode("::", $this-
>theArrayElements);
                        for ($I = 0; $I < count($_ELEMENTS_); $I++)
                        {

                                if ($_TAG_ == $_ELEMENTS_[$I])
                                {

                                        $this->theArrayGetElement = 
$_ELEMENTS_[$I];

                                }

                        }

                }


                function Tag_Close($_PARSER_, $_TAG_)
                {

                        if ($_TAG_ == $this->theArrayTopElement)
                        {

                                $this->theArrayPointer++;

                        }

                        $this->theArrayGetElement = NULL;

                }


                function CData($_PARSER_, $_CDATA_)
                {

                        if ($this->theArrayGetElement != NULL)
                        {

                                $this->theArray[$this->theArrayPointer]
[$this->theArrayGetElement] = $_CDATA_;
                                //print_r($this->theArray);   <--- 
shows the multi-dimentional array

                        }

                }

        }


?>


-- 

[ Swift eNetwork ] Matrix
http://matrix.swifte.net/

--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to