if(weather.getForecasts() != null) {
for(int i = 0; i < weather.getForecasts().length; i++) {
Element forecast = new Element("forecast",
WeatherModuleGenerator.NS);
Forecast f = weather.getForecasts()[i];
if(f.getCode() != null) {
forecast.setAttribute("code",
Integer.toString(f.getCode().getCode()));
}
if(f.getDate() != null) {
forecast.setAttribute("date", SHORT_DATE.format(f.getDate()));
}
if(f.getDay() != null) {
forecast.setAttribute("day", f.getDay());
}
if(f.getText() != null) {
forecast.setAttribute("text", f.getText());
}
forecast.setAttribute("high", Integer.toString(f.getHigh()));
forecast.setAttribute("low", Integer.toString(f.getLow()));
element.addContent(forecast);
}
}
}