Soluzioni macchinose?????
In dom xml
Codice PHP:
$doc = new DOMDocument();
$doc->load('dati.xml');
$elements = $doc->get_elements_by_tagname("SQUADRA");
foreach($elements as $el) {
echo "name= ".( $el->get_attribute("Posizione") );
Come avevi proposto te in simple xml
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;
}
}
Mi pare che il codice parli da solo.