l'esempio che interessa a te è questo:

codice:
<?php
include 'example.php';

$xml = new SimpleXMLElement($xmlstr);

/* Access the <rating> nodes of the first movie.
 * Output the rating scale, too. */
foreach ($xml->movie[0]->rating as $rating) {
    switch((string) $rating['type']) { // Get attributes as element indices
    case 'thumbs':
        echo $rating, ' thumbs up';
        break;
    case 'stars':
        echo $rating, ' stars';
        break;
    }
}
?>
Se guardi l'xml di esempio contiene questi nodi:

codice:
<rating type="thumbs">7</rating>
  <rating type="stars">5</rating>
Il fatto che tu lo carichi da file non cambia nulla, perchè quello che ottieni è sempre un oggetto simplexml.

ciao