Je voudrais savoir, comment lire les donnée qui ce trouve dans ces balises :
Car si je li simplement le noeud, j'obtient une liste de petit symbole (des petit rectangle).<![CDATA[ ]]>
D'avance je vous remercie pour votre aide.
Car si je li simplement le noeud, j'obtient une liste de petit symbole (des petit rectangle).<![CDATA[ ]]>
Code : Tout sélectionner
<weatherIconUrl>
<![CDATA[http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0002_sunny_intervals.png]]>
</weatherIconUrl>
Code : Tout sélectionner
*nodeUrlIcon = XMLNodeFromPath(MainXMLNode(#xmlWeather), "current_condition/weatherIconUrl")
UrlIcon$ = GetXMLNodeText(*nodeUrlIcon)
Debug "Url icone: " + UrlIcon$
Code : Tout sélectionner
<?xml version="1.0" encoding="UTF-8"?>
<data>
<request>
<type>City</type>
<query>Dhaka, Bangladesh</query>
</request>
<current_condition>
<observation_time>01:57 PM</observation_time>
<temp_C>33</temp_C>
<temp_F>91</temp_F>
<weatherCode>113</weatherCode>
<weatherIconUrl>
<![CDATA[http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0008_clear_sky_night.png]]>
</weatherIconUrl>
<weatherDesc>
<![CDATA[Clear ]]>
</weatherDesc>
<windspeedMiles>2</windspeedMiles>
<windspeedKmph>4</windspeedKmph>
<winddirDegree>77</winddirDegree>
<winddir16Point>ENE</winddir16Point>
<precipMM>0.0</precipMM>
<humidity>76</humidity>
<visibility>10</visibility>
<pressure>1006</pressure>
<cloudcover>2</cloudcover>
</current_condition>
<weather>
<date>2013-10-11</date>
<tempMaxC>36</tempMaxC>
<tempMaxF>97</tempMaxF>
<tempMinC>25</tempMinC>
<tempMinF>77</tempMinF>
<windspeedMiles>5</windspeedMiles>
<windspeedKmph>8</windspeedKmph>
<winddirection>ENE</winddirection>
<winddir16Point>ENE</winddir16Point>
<winddirDegree>65</winddirDegree>
<weatherCode>113</weatherCode>
<weatherIconUrl>
<![CDATA[http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0001_sunny.png]]>
</weatherIconUrl>
<weatherDesc>
<![CDATA[Sunny]]>
</weatherDesc>
<precipMM>0.0</precipMM>
</weather>
</data>
Code : Tout sélectionner
Enumeration
#XML
EndEnumeration
Global Buffer.s, NodeName.s, NodeText.s
Procedure ReadXML(*CurrentNode, CurrentSublevel)
If XMLNodeType(*CurrentNode) = #PB_XML_Normal Or XMLNodeType(*CurrentNode) = #PB_XML_CData
If XMLNodeType(*CurrentNode) = #PB_XML_Normal
Buffer = ""
NodeName = GetXMLNodeName(*CurrentNode) ; Nom du noeud
NodeText = GetXMLNodeText(*CurrentNode) ; Valeur du noeud
If Trim(RemoveString(NodeText, #CRLF$))<>""
Buffer = NodeName + " = " + NodeText
EndIf
EndIf
If XMLNodeType(*CurrentNode) = #PB_XML_CData
NodeText = GetXMLNodeText(*CurrentNode) ; Valeur du noeud
Buffer = NodeName + " = " + NodeText
EndIf
If Trim(Buffer)<>""
Debug Trim(Buffer)
EndIf
EndIf
*ChildNode = ChildXMLNode(*CurrentNode)
While *ChildNode <> 0
ReadXML(*ChildNode, CurrentSublevel + 1)
*ChildNode = NextXMLNode(*ChildNode)
Wend
EndProcedure
FileName$ = OpenFileRequester("Ouvrir un fichier XML...", "", "Fichier XML (*.xml)|*.xml|Tous les fichiers (*.*)|*.*", 0)
If FileName$ <> ""
If LoadXML(#XML, FileName$)
If XMLStatus(#XML) <> #PB_XML_Success
Message$ = "Error in the XML file:" + Chr(13)
Message$ + "Message: " + XMLError(#XML) + Chr(13)
Message$ + "Line: " + Str(XMLErrorLine(#XML)) + " Character: " + Str(XMLErrorPosition(#XML))
MessageRequester("Error", Message$)
EndIf
*MainNode = MainXMLNode(#XML)
If *MainNode
ReadXML(*MainNode, 0)
EndIf
Else
MessageRequester("Erreur", "Ce fichier XML ne peut etre ouvert")
EndIf
EndIf
En espérant que c'était bien l'objet de ta demandetype = City
query = Dhaka, Bangladesh
observation_time = 01:57 PM
temp_C = 33
temp_F = 91
weatherCode = 113
weatherIconUrl = http://cdn.worldweatheronline.net/image ... _night.png
weatherDesc = Clear
windspeedMiles = 2
windspeedKmph = 4
winddirDegree = 77
winddir16Point = ENE
precipMM = 0.0
humidity = 76
visibility = 10
pressure = 1006
cloudcover = 2
date = 2013-10-11
tempMaxC = 36
tempMaxF = 97
tempMinC = 25
tempMinF = 77
windspeedMiles = 5
windspeedKmph = 8
winddirection = ENE
winddir16Point = ENE
winddirDegree = 65
weatherCode = 113
weatherIconUrl = http://cdn.worldweatheronline.net/image ... _sunny.png
weatherDesc = Sunny
precipMM = 0.0