Parsing XML data from Openweather map?

how to parse the response data from the link below:

api.openweathermap.org/data/2.5/weather?q=77079,us&mode=xml&appid=

please add your own appid. I just want to extract all the values. Thanks.

Yeah, if you’re asking for help, it might be a good idea to provide the information we need, rather than have us create accounts for things we don’t need/want. If you could show an example of what a response would look like, we might be able to help better.
Additionally, there have been quite a lot of topics regarding openweather already. You might want to give the search function a try.

1 Like

I would recommend reading the data in JSON format, not XML. The SparkJson library is in the community library section and works pretty well. Just remove the mode=xml from the request URL; the default is JSON.

1 Like
<current>
  <city id="4677432" name="Bunker Hill Village">
    <coord lon="-95.53" lat="29.77" />
    <country>US</country>
    <sun rise="2016-04-12T11:57:11" set="2016-04-13T00:48:13" />
  </city>
  <temperature value="297.97" min="296.15" max="300.65" unit="kelvin" />
  <humidity value="69" unit="%" />
  <pressure value="1016" unit="hPa" />
  <wind>
    <speed value="6.7" name="Moderate breeze" />
    <gusts />
    <direction value="40" code="NE" name="NorthEast" />
  </wind>
  <clouds value="75" name="broken clouds" />
  <visibility />
  <precipitation mode="no" />
  <weather number="803" value="broken clouds" icon="04d" />
  <lastupdate value="2016-04-12T22:02:15" />
</current>

@rickkas7, thanks. I saw the JSON parser in the library. But I saw the simple xml parser in the webhook example. Thought xml might be simpler to extract.

I have parsed XML from the web using strtok and wrote about it here:

@bko, thanks. I am able to parse it now.