HELP!!! [Try to make class for parsing XML]

[email protected] ("???????????? ?.?.")
Newsgroups php.xml.dev
Message-ID <[email protected]>
Hi!!! Please Help me. I look on it code 2 hours and cant see what wrong!

class TPageData
{
     var $FileName;
 var $start_element;
 var $end_element;
 var $data_of_element;
 var $currentElement;

 function makeFileParser()
 {
         /* Creating the xml parser */
         $xml_parser = xml_parser_create();

         xml_set_element_handler($xml_parser, $this->start_element,
$this->end_element);
         xml_set_character_data_handler($xml_parser,
$this->data_of_element);

         xml_parser_set_option ($xml_parser, XML_OPTION_CASE_FOLDING,
FALSE);


         if (!($fp = fopen($this->FileName,"r")))
  {
              die("Cannot open $xmlSource.");
         }
         while (($data = fread($fp,4096)))
  {
              if (!xml_parse($xml_parser, $data, feof($fp)))
   {
                  die (sprintf("XML error at line %d column %d ",
                       xml_get_current_line_number($xml_parser),
                       xml_get_current_column_number($xml_parser)));
              }
         }

  fclose($fp);
         xml_parser_free($xml_parser);
     }


 function startElement($parser, $name, $attr)
     {
  $this->currentElement = $name;
        }

 function endElement($parser, $name)
     {
 }

 function characterData($parser, $data)
 {
  print "!_" . $this->currentElement . "_!";  // AND I SEE "!__!" ON THE
SCREEN. IT MEANS THAT currentElement HAVNT VALUE/ WHY??????
  if ($this->currentElement == 'page_title')
  {
   $this->pageTitle = $data;
  }
 }

 function TPageData($Name)
 {
  $this->FileName = $Name;

  $this->start_element = array($this,"startElement");
  $this->end_element = array($this,"endElement");
  $this->data_of_element = array($this,"characterData");


  $this->makeFileParser();
 }

}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.