Hello.
I am creating an amateur app with the openweather API...the free one gives me both current conditions and forecasts every 3 hours for the next 5 days.
Up to the current conditions all ok, when I try to enter the forecasts I have a problem. One forecast looks like this:
<weatherdata>
<location>
<name>Municipality of Bari</name>
<type/>
<country>IT</country>
<timezone>7200</timezone>
<location altitude="0" latitude="41.1177" longitude="16.8512" geobase="geonames" geobaseid="6542001"/>
</location>
<credit/>
<meta>
<lastupdate/>
<calctime>0</calctime>
<nextupdate/>
</meta>
<sun rise="2022-08-16T04:03:00" set="2022-08-16T17:51:07"/>
<forecast>
<time from="2022-08-16T15:00:00" to="2022-08-16T18:00:00">
<symbol number="500" name="light rain" var="10n"/>
<precipitation probability="0.26" unit="3h" value="0.53" type="rain"/>
<windDirection deg="119" code="ESE" name="East-southeast"/>
<windSpeed mps="0.75" unit="m/s" name="Calm"/>
<windGust gust="1.4" unit="m/s"/>
<temperature unit="celsius" value="30.87" min="29.62" max="30.87"/>
<feels_like value="32.21" unit="celsius"/>
<pressure unit="hPa" value="1011"/>
<humidity value="49" unit="%"/>
<clouds value="cielo sereno" all="8" unit="%"/>
<visibility value="10000"/>
</time>
<time from="2022-08-16T18:00:00" to="2022-08-16T21:00:00">
<symbol number="801" name="poche nuvole" var="02n"/>
<precipitation probability="0.06"/>
<windDirection deg="354" code="N" name="North"/>
<windSpeed mps="0.66" unit="m/s" name="Calm"/>
<windGust gust="1.82" unit="m/s"/>
<temperature unit="celsius" value="29.7" min="28.8" max="29.7"/>
<feels_like value="31.39" unit="celsius"/>
<pressure unit="hPa" value="1011"/>
<humidity value="55" unit="%"/>
<clouds value="poche nuvole" all="11" unit="%"/>
<visibility value="10000"/>
</time>
</forecast>
</weatherdata>
(formatted by Taifun)
I'm using XML format, and as you can see the file consists of two "times" that I can't split. I tried to do it this way, but it gives me an error:
How can I make it read only the first "time," then the second and so on?