Bonsoir
J'ai encore une question par rapport à un fichier xml
Dans ce fichier, je voudrais récupérer la valeur de la balise low dans la première balise forecast_conditions
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 <?xml version="1.0" ?> - <xml_api_reply version="1"> - <weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0"> - <forecast_information> <city data="Lillebonne, Upper-Normandy" /> <postal_code data="Lillebonne" /> <latitude_e6 data="" /> <longitude_e6 data="" /> <forecast_date data="2010-12-02" /> <current_date_time data="2010-12-02 22:20:27 +0000" /> <unit_system data="SI" /> </forecast_information> - <current_conditions> <condition data="Averses de neige" /> <temp_f data="27" /> <temp_c data="-3" /> <humidity data="Humidité : 91 %" /> <icon data="/ig/images/weather/snow.gif" /> <wind_condition data="Vent : N à 3 km/h" /> </current_conditions> - <forecast_conditions> <day_of_week data="jeu." /> <low data="-3" /> <high data="-2" /> <icon data="/ig/images/weather/partly_cloudy.gif" /> <condition data="Couverture nuageuse partielle" /> </forecast_conditions> - <forecast_conditions> <day_of_week data="ven." /> <low data="-2" /> <high data="1" /> <icon data="/ig/images/weather/partly_cloudy.gif" /> <condition data="Couverture nuageuse partielle" /> </forecast_conditions> - <forecast_conditions> <day_of_week data="sam." /> <low data="-1" /> <high data="6" /> <icon data="/ig/images/weather/rain_snow.gif" /> <condition data="Pluie et Neige" /> </forecast_conditions> - <forecast_conditions> <day_of_week data="dim." /> <low data="2" /> <high data="6" /> <icon data="/ig/images/weather/rain.gif" /> <condition data="Pluie" /> </forecast_conditions> </weather> </xml_api_reply>
Je pensais que ce code suffirait mais j(ai une erreur et comme je ne connais pas suffisament ce langage.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 set conditionElement= xmlDoc.selectNodes("/xml_api_reply/weather/forecast_conditions") low=conditionElement.selectSingleNode("low").Attributes.getNamedItem("data").Text
Merci de votre aide
Cordialement
Boboss76![]()
Partager