Ciao, non so quanto complsso sia il tuo xml ma io per i miei xml classici... tag e testo uso questo

Codice PHP:
    function getDictionaryValue($section="",$xmlFile="")
    {
        
$xml simplexml_load_file($xmlFile);        
        if(
$section != "")
        {              
            return 
self::object2array($xml->{$section});
        }
        else
        {   
            return 
$xml;
        }
    }    

    function 
object2array($object)
    {
       
$return NULL;
       if(
is_array($object))
       {
           foreach(
$object as $key => $value)
               
$return[$key] = self::object2array($value);
       }
       else
       {
           
$var get_object_vars($object);
           if(
$var)
           {
               foreach(
$var as $key => $value)
                   
$return[$key] = ($key && !$value) ? NULL self::object2array($value);
           }
           else return 
$object;
       }
       return 
$return;
    } 
xml e' il nome dell xml appunto e section e' il tag da prendere(se non passo la sezione prendo tutto)