"; }*/ } function end_tag($xml_parser,$name) { #echo "
"; global $line; $line=0; global $line; $line=false; } function PCData($xml_parser,$data) { global $tag; if(line) { //echo $tag."
".$data."
"; echo "".substr(htmlentities($data),0,30)."...
"; global $line; $line=false; /* $test=htmlspecialchars($data); echo substr($test,0,30)."
";*/ } //echo $data."


"; } function PIData($xml_parser,$target,$data) { } $xml_parser=xml_parser_create("ISO-8859-1"); $state=xml_set_element_handler($xml_parser,"begin_tag","end_tag"); if(!state) { die("error with element handler!"); } $state=xml_set_character_data_handler($xml_parser,"PCData"); if(!state) { die("error with PCData handler!"); } $state=xml_set_processing_instruction_handler($xml_parser,"PIData"); if(!state) { die("error with PIData handler!"); } $state=xml_set_default_handler($xml_parser,""); if(!state) { die("error with default handler!"); } $file=fopen("sport_.xml","r"); $line=false; while(!feof($file)) { $data=fgets($file,1000); xml_parse($xml_parser,$data); $line=false; } fclose($file); xml_parser_free($xml_parser); ?>