Recup valeur tag après application filtre xpath
Bonjour, je cherche depuis plusieurs heures à récupérer le numéro de téléphone suivant:
(simplexml)
Code:
$tel = Resultats->Resultat->MoyensCommunications->DetailMoyenCom[0]->Coord;
Pour cela, je dois filtrer en fonction du 'Type' ou 'Libellé' car plusieurs noeuds 'DetailMoyenCom' sont présents dans le flux et l'ordre n'est pas toujours le même
J'ai donc utilisé xpath mais je ne trouve pas la bonne syntaxe permettant d'extraire le numéro de tel.
Ci-dessous, la partie du flux concerné:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <?xml version="1.0" encoding="utf-8" ?>
<ListeResultat xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://SitraWS/">
<Resultats>
<Resultat>
<MoyensCommunications>
<DetailMoyenCom>
<Type>04.02.01</Type>
<Libelle>Téléphone</Libelle>
<Coord>04 XX XX XX XX</Coord>
<ObservationDetailMoyenCom />
</DetailMoyenCom>
<DetailMoyenCom>
<Type>04.02.02</Type>
<Libelle>Fax</Libelle>
<Coord>04 XX XX XX XX</Coord>
<ObservationDetailMoyenCom />
</DetailMoyenCom>
<DetailMoyenCom>
<Type>04.02.04</Type>
<Libelle>Mél</Libelle>
<Coord>infos@kjhdkjhkjhd.com</Coord>
<ObservationDetailMoyenCom />
</DetailMoyenCom> |