| 
				 开发完将风向角度转化为文字信息的fromDegreeToDirectionStr方法后,就可以开发将天气情况代码转换为文字信息的fromCodeToText方法了,其代码如下: 
public static String fromCodeToText(int code){  
switch(code){ 
case 0: return "龙卷风";case 1: return "热带风暴"; 
case 2: return "飓风";case 3: return "雷暴雨"; 
case 4: return "雷雨";case 5: return "雨夹雪"; 
case 6: return "雨夹冰雹";case 7: return "雪夹冰雹"; 
case 8: return "冻毛毛雨";case 9: return "毛毛雨"; 
case 10: return "冻雨";case 11: return "阵雨"; 
case 12: return "阵雪";case 13: return "雪小雪"; 
case 14: return "小雪骤雨";case 15: return "风雪"; 
case 16: return "雪";case 17: return "冰雹";         
case 18: return "雨夹雪";case 19: return "尘"; 
case 20: return "雾";case 21: return "霾"; 
case 22: return "黑烟";case 23: return "狂风"; 
case 24: return "风";case 25: return "冷"; 
case 26: return "多云"; 
case 27: return "夜间大部多云"; 
case 28: return "日间大部多云"; 
case 29: return "夜间部分多云"; 
case 30: return "日间部分多云"; 
case 31: return "夜间晴朗";case 32: return "日间晴朗"; 
case 33: return "夜间清晰";case 34: return "日间清晰"; 
case 35: return "雨夹雹";case 36: return "热"; 
case 37: return "局部雷阵雨";case 38: return "零星雷阵雨"; 
case 39: return "零星雷阵雨";case 40: return "零星暴雨"; 
case 41: return "大雪";case 42: return "零星暴雪"; 
case 43: return "大雪";case 44: return "部分多云"; 
case 45: return "雷阵雨";case 46: return "阵雪"; 
case 47: return "局部地区雷阵雨"; 
case 3200:  return "不可用"; 
default: return "没有此代码"; } 
} 
在两个用于信息转换的辅助方法都开发完成后,就可以开发用于获取并解析显示天气XML文档的parseWeather方法了,其代码如下: 
public static void parseWeather 
(YahooWeatherFrame ywf,String cityCode){         
try{ 
//为解析XML文件创建DOM对象 
DocumentBuilderFactory factory =  
DocumentBuilderFactory.newInstance(); 
DocumentBuilder builder= 
factory.newDocumentBuilder();     
//远程URL解析 
URL url=new URL("http://xml.weather.yahoo."+ 
"com/forecastrss?u=c&p="+cityCode); 
Document doc=builder.parse(url.openStream());  
doc.normalize(); //规格化  
//解析天气预报发布时间 			
				 |