-2
我是Iphone App開發中的新手。我正在我的應用程序中實施Google Weather API。我使用教程代碼,它使用NSXMLParser進行分析。我在下面的方法中刪除了教程代碼。我使用這個谷歌API http://www.google.com/ig/api?weather=nabha如何解析XML文件
現在我做什麼來獲得輸出。當前溫度,高溫,低溫等。
任何提示和解決方案真的很感激。
謝謝
我的方法是。
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict {
NSLog(@"Processing Element: %@", elementName);
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
}
2012-07-25 19:20:14.654 XML[4555:f803] Processing Element: xml_api_reply
Current language: auto; currently objective-c
Processing Element: weather
Processing Element: forecast_information
Processing Element: city
Processing Element: postal_code
Processing Element: latitude_e6
Processing Element: longitude_e6
Processing Element: forecast_date
Processing Element: current_date_time
Processing Element: unit_system
Processing Element: current_conditions
Processing Element: condition
Processing Element: temp_f
Processing Element: temp_c
Processing Element: humidity
Processing Element: icon
Processing Element: wind_condition
etc......
2012-07-25 19:20:44.042 XML[4555:f803] No Errors