}
private static Forecast readForecast(XMLStreamReader streamReader) throws XMLStreamException {
Forecast forecast = new Forecast();
int eventType = 0;
do{
eventType = streamReader.next();
if( eventType == XMLStreamConstants.START_ELEMENT ){
if( streamReader.getLocalName().equals("day_of_week") ){
forecast.setDia(streamReader.getAttributeValue(null,"data"));
}
else if( streamReader.getLocalName().equals("low") ){
forecast.setMin( streamReader.getAttributeValue(null,"data") );
}
else if( streamReader.getLocalName().equals("high") ){
forecast.setMax( streamReader.getAttributeValue(null,"data") );
}
else if( streamReader.getLocalName().equals("icon") ){
forecast.setIcon( streamReader.getAttributeValue(null,"data") );
}
else if( streamReader.getLocalName().equals("condition") ){
forecast.setCondicao( streamReader.getAttributeValue(null,"data") );
}
}
} while( streamReader.hasNext()
&& !( eventType == XMLStreamConstants.END_ELEMENT && streamReader.getLocalName().equals("forecast_conditions") )
);