Java Reference
In-Depth Information
NodeList currWeatherLocation
= doc.getElementsByTagNameNS("http://xml.weather.yahoo.com/
ns/ rss/1.0", "location");
Weather weather = new Weather();
weather.city
= obtainAttribute(currWeatherLocation, "city");
weather.region
= obtainAttribute(currWeatherLocation, "region");
weather.country
= obtainAttribute(currWeatherLocation, "country");
NodeList currWeatherCondition
= doc.getElementsByTagNameNS("http://xml.weather.yahoo.com/
ns/
rss/1.0", "condition");
weather.dateTimeStr
= obtainAttribute(currWeatherCondition, "date");
weather.currentWeatherText
= obtainAttribute(currWeatherCondition, "text");
weather.temperature
= obtainAttribute(currWeatherCondition, "temp");
String forcast
= doc.getElementsByTagName("description")
.item(1)
.getTextContent();
weather.htmlDescription = forcast;
return weather;
}
}
class Weather {
String dateTimeStr;
String city;
String region;
Search WWH ::




Custom Search