Tryag File Manager
Home
-
Turbo Force
Current Path :
/
home
/
cluster1
/
data
/
bu01
/
1121861
/
html
/
jlex
/
php4
/
Upload File :
New :
File
Dir
//home/cluster1/data/bu01/1121861/html/jlex/php4/menu_items_parser.php4
<? class menu_items_parser { var $parser; var $data; var $results; var $phrase; function startHandler($xp,$element,$attribs) { } function endHandler($xp,$element) { $element = strtolower($element); if($element == "english") { $this->phrase = $this->data; } else if($element == "value") { $this->results[$this->phrase] = $this->data; $this->phrase = ""; } $this->data = ""; } function cDataHandler($xp,$data) { $data = trim($data); if($data != "") { $this->data .= $data; } } function get_menu_items($xml) { $this->parser = xml_parser_create(); xml_set_object($this->parser, $this); xml_set_element_handler($this->parser, "startHandler", "endHandler"); xml_set_character_data_handler($this->parser, "cDataHandler"); $this->results = array(); $in = fopen($xml,"r"); while($line = fgets($in)) { xml_parse($this->parser,$line,false); } return $this->results; } } ?>