Weather Forecast: Lecture Notes
Weather Forecast: Lecture Notes
Weather Forecast
res/raw/weather.xml
<?xml version=1.0 encoding= utf-8?>
<infos>
<city id=sh>
<name> Shanghai </name>
<temp> 20/30 </temp>
<weather> Cloudy </weather>
<pm> 80</pm>
<wind>Level 3</wind>
</city>
<city id=bj>
<name> Beijing </name>
<temp> 16/25 </temp>
<weather> Sunny </weather>
<pm>1 80</pm>
<wind>Level 1</wind>
</city>
<city id=gz>
<name> Guangzhou</name>
<temp> 27/35 </temp>
<weather>Sunny </weather>
<pm> 70</pm>
<wind>Level2</wind>
</city>
</infos>
switch(type){
case XmlPullParser.START_TAG:
parser.getName();
parser.nextText();
.
break;
case XmlPullParser.END_TAG:
parser.getName();
parser.nextText();
break;
}
Type= parser.next(); //go to the next event type
}//while loop