/* when expat hits a closing tag, it fires up this function */
function endElement($parser, $name) {
$curtag = implode("_",$this->current_tag); // piece together tag
// before we pop it off,
// so we can get the correct
// cdata
if(!$this->tagdata["$curtag"]) {
$popped = array_pop($this->current_tag); // or else we screw up where we are
return; // if we have no data for the tag
} else {
$TD = $this->tagdata["$curtag"];
unset($this->tagdata["$curtag"]);
}
$popped = array_pop($this->current_tag);
// we want the tag name for
// the tag above this, it
// allows us to group the
// tags together in a more
// intuitive way.
if(sizeof($this->current_tag) == 0) return; // if we aren't in a tag
$curtag = implode("_",$this->current_tag); // piece together tag
// this time for the arrays
// set up some options and handlers
xml_set_object($this->xml_parser,$this);
xml_parser_set_option($this->xml_parser,XML_OPTION_CASE_FOLDING,0);
xml_set_element_handler($this->xml_parser, "startElement", "endElement");
xml_set_character_data_handler($this->xml_parser, "characterData");
if (!xml_parse($this->xml_parser, $data, TRUE)) {
sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($this->xml_parser)),
xml_get_current_line_number($this->xml_parser));
}
// we are done with the parser, so let's free it
xml_parser_free($this->xml_parser);