// Create an XML parser
$xml_parser = xml_parser_create();
// Set the functions to handle opening and closing tags
xml_set_element_handler($xml_parser, "startElement", "endElement");
// Set the function to handle blocks of character data
xml_set_character_data_handler($xml_parser, "characterData");
was at the top.
I actually just got it working
// create parser object
$xml_parser = xml_parser_create();
// set up some options and handlers
xml_parser_set_option($xml_parser,XML_OPTION_CASE_FOLDING,0);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!xml_parse($xml_parser, $data, TRUE)) {
sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser));
}
// we are done with the parser, so let's free it
xml_parser_free($xml_parser);
$data is the variable and it's reading through it fine. I'm not sure how exactly as I had just fooled around with working code from another script. But it is doing the job so now I can parse whatever thankfully.