XML Data into an array

Using Jubba’s tutorial I’ve manged to parse an xml file with php… my problem now is getting the values into an array… look at this:



<?php
    $file  = "xmlTestFile.xml";

    $arr = array();

    function contents($parser, $data){
        array_push($arr, $data);
    }

    function startTag($parser, $data){
            
    }

    function endTag($parser, $data){
            
    } 
    
    $xml_parser  =  xml_parser_create();
    xml_set_element_handler($xml_parser, "startTag", "endTag");
    xml_set_character_data_handler($xml_parser, "contents");

    $fp = fopen($file, "r");
    $data = fread($fp, 80000);

    if(!(xml_parse($xml_parser, $data, feof($fp)))){
            die("Error on line " . xml_get_current_line_number($xml_parser));
    }

    echo "COUNT: ";
    echo count($arr);
    xml_parser_free($xml_parser);

    fclose($fp); 

?>


So when the parser finds content it should add the value to the array right? Or am I missing something here?

Cheers.