0

I'm trying to unmarshall the following XML, but because I started today, I simply don't know how to do it.

<cidade>
   <nome>Araraquara</nome>
   <uf>SP</uf>
   <atualizacao>2018-08-15</atualizacao>
   <previsao>
      <dia>2018-08-16</dia>
      <tempo>npp</tempo>
      <maxima>27</maxima>
      <minima>15</minima>
      <iuv>7.0</iuv>
   </previsao>
   <previsao>
      <dia>2018-08-17</dia>
      <tempo>pc</tempo>
      <maxima>27</maxima>
      <minima>14</minima>
      <iuv>7.0</iuv>
   </previsao>
   <previsao>
      <dia>2018-08-18</dia>
      <tempo>pn</tempo>
      <maxima>28</maxima>
      <minima>14</minima>
      <iuv>6.0</iuv>
   </previsao>
   <previsao>
      <dia>2018-08-19</dia>
      <tempo>ps</tempo>
      <maxima>29</maxima>
      <minima>15</minima>
      <iuv>6.0</iuv>
   </previsao>
</cidade>

(For the non-Portuguese speakers: previsao means "forecast"; then, this XML is a weather forecast)

I wish whoever did this API had the brilliant idea of nesting "previsao" tags into a "previsoes" tag, but that didn't happen (would be easier). Any ideas on how can I do that? Any other libraries aside of JAXB or links of other SO questions would be great too. Needing on the Java code may apply. Thanks so far.

0 Answers0