Nevermind... i got it.
<?xml version="1.0" encoding="utf-8"?>
<panelTitle>
<title>
<lang>ar</lang>
<text>ولو امتلكت</text>
</title>
<title>
<lang>en</lang>
<text>Latest news</text>
</title>
<title>
<lang>fr</lang>
<text>la pensée son</text>
</title>
<title>
<lang>jp</lang>
<text>動物の間の相</text>
</title>
<title>
<lang>sp</lang>
<text>pueda adquirir</text>
</title>
</panelTitle>
<?php
$xml_file = "../uiText/news_panel.xml";
$xml_lang_key = "*PANELTITLE*TITLE*LANG";
$xml_text_key = "*PANELTITLE*TITLE*TEXT";
$story_array = array();
$counter = 0;
class xml_story{
var $lang, $text;
}
function startTag($parser, $data){
global $current_tag;
$current_tag .= "*$data";
}
function endTag($parser, $data){
global $current_tag;
$tag_key = strrpos($current_tag, '*');
$current_tag = substr($current_tag, 0, $tag_key);
}
function contents($parser, $data){
global $current_tag, $xml_lang_key, $xml_text_key, $counter, $story_array;
switch($current_tag){
case $xml_lang_key:
$story_array[$counter] = new xml_story();
$story_array[$counter]->lang = $data;
break;
case $xml_text_key:
$story_array[$counter]->text = $data;
$counter++;
break;
}
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startTag", "endTag");
xml_set_character_data_handler($xml_parser, "contents");
$fp = fopen($xml_file, "r")
or die("Could not open file");
$data = fread($fp, filesize($xml_file))
or die("Could not read file");
if(!(xml_parse($xml_parser, $data, feof($fp)))){
die("Error on line " . xml_get_current_line_number($xml_parser));
}
xml_parser_free($xml_parser);
fclose($fp);
for($x=0;$x<count($story_array);$x++){
echo "\t<h2>" . $story_array[$x]->lang . "</h2>\n";
echo "\t\t\n";
echo "\t<i>" . $story_array[$x]->text . "</i>\n";
}
?>