Bonjour
Je n'arrive pas à accéder à certains éléments (en gras dans l'extrait ci-dessous) d'un XML que j'ai à exploiter.
Voici un extrait du xml
Voici un extrait du code PHP utilisé
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 <?xml version="1.0" encoding="UTF-8"?> <XLS version="1.2" xmlns="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml" xmlns:xls="http://www.opengis.net/xls" xmlns:xlsext="http://www.opengis.net/xlsext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://wxs.ign.fr/schemas/olsAll.xsd"> <ResponseHeader/> <Response requestID="abc" version="1.2"> <ReverseGeocodeResponse> <ReverseGeocodedLocation> <gml:Point> <gml:pos>45.950091 1.134881</gml:pos> </gml:Point> <Address countryCode="PositionOfInterest"> <StreetAddress/> <Place type="Municipality">peyrilhac</Place> <Place type="Departement">87</Place> <Place type="Bbox">1.057805;45.932981;1.177533;45.995295</Place> <Place type="Importance">4</Place> <Place type="Commune">Peyrilhac</Place> <Place type="INSEE">87118</Place> <Place type="Nature">Commune</Place> <Place type="Territoire">FXX</Place> <PostalCode>87510</PostalCode> </Address> <xlsext:ExtendedGeocodeMatchCode>City</xlsext:ExtendedGeocodeMatchCode> <SearchCentreDistance value="0.00"/> </ReverseGeocodedLocation>
Je crois avoir essayé toutes les combinaisons pour gml, gml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 $xml = simplexml_load_string($texte); // print_r($xml->Response); exit; // $reponse .= $xml->Response['requestID'] . "\n"; $Lieudit=$Commune=''; foreach($xml->Response->ReverseGeocodeResponse->ReverseGeocodedLocation as $ReverseGeocodeLocation) { // print_r($ReverseGeocodeResponse); exit; $Point = $ReverseGeocodeLocation->{'gml:Point'}; print_r($Point)."<hr>"; $aPlace[] = array(); $aPlace['LAT_LON'] = (string)$Point->{'gml:pos'}; $aPlace['Distance'] = (string)$ReverseGeocodeLocation->SearchCentreDistance["value"]; $Address = $ReverseGeocodeLocation->Address; foreach ($Address->Place as $Place) { $type = (string)$Place['type']; $aPlace[$type] = (string)$Place; }oint ...
Une idée ?
Partager