This is a small part of XML.
wind_gust_mph>3.0/wind_gust_mph>
wind_kph>1.6/wind_kph>
wind_gust_kph>4.8/wind_gust_kph>
I retrieved it from http://api.wunderground.com/api/fbfd68ef77a4a2cd/conditions/q/NewZealand/Auckland.xml
The below is my code:
public MyWeather parseWeather(Document srcWunderGroundDoc){
MyWeather myWeather = new MyWeather();
Node windGust = srcWunderGroundDoc.getElementsByTagName("wind_gust_mph").item(0);
myWeather.gust = windGust.getAttributes().getNamedItem("wind_gust_mph").getNodeValue().toString();
}
When I tried to run my app and it crashed. Can someone show me how to get three tags above?
0 comments:
Post a Comment