"); $z++; $depth[$parser]++; } function endElement($parser, $name) { global $depth; $depth[$parser]--; } // file for files larger than 10 MB gives problems //if (!($fp = fopen($file,http://127.0.0.1/domtest.php "r"))) { // die("could not open XML input"); //} $data = implode("", file($file)); $xml_parser = xml_parser_create(); xml_parser_set_option ( $xml_parser, XML_OPTION_CASE_FOLDING, 0 ); xml_parser_set_option ( $xml_parser, XML_OPTION_TARGET_ENCODING, 'UTF-8' ); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_parse_into_struct($xml_parser, $data, $values, $tags); while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } /* for ($k=1;$k<500;$k++) { echo ($values[$k]["tag"]); echo ($values[$k]["value"]); echo ("
"); } */ //echo ($values[1][value]); //echo ($values[5][value]); // print_r($tags); global $z; //echo ("***************************************************************"); /* print_r($values); echo ("
"); echo ("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); echo ("
"); print_r($tags); */ xml_parser_free($xml_parser); ?>