se usi PHP 5 potresti provare l'estensione SimpleXML.
Esempio:
Codice PHP:
<?php
$xml_string = "<?xml version='1.0' standalone='yes'?>
<utenti>
<utente>
<nome>Mario</nome>
<cognome>Rossi</cognome>
<telefono type="casa">123456789</telefono>
<telefono type="mobile">987654321</telefono>
</utente>
</utenti>";
$xml = simplexml_load_string($xml_string);
print_r($xml)
?>
Risultato:
SimpleXMLElement Object
(
[utente] => SimpleXMLElement Object
(
[nome] => Mario
[cognome] => Rossi
[telefono] => Array
(
[0] => 123456789
[1] => 987654321
)
)
)