我想使用网络服务并从服务中获取数据。我能够发送请求并接收数据,但可以帮助我解析它。这是我的代码。我想解析 XML 响应并将其存储在数组中以供进一步使用
-(void)performSearch:(NSString *)searchText
{
NSString *param = [NSString stringWithFormat:@"ZIP=%@",
searchText];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://wsf.cdyne.com/WeatherWS/Weather.asmx/GetCityForecastByZIP?%@", param]];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setRequestMethod:@"GET"];
[request addRequestHeader:@"Content-Type" value:@"application/x-www-form-urlencoded"];
NSLog(@"%@",param);
NSLog(@"%@",url);
NSLog(@"%@",request);
[request setDelegate:self];
[request startAsynchronous];
}
- (void)requestFinished:(ASIHTTPRequest *)request
{
NSData *response = [request responseData];
NSLog(@"%@",response);
help me how to parse the data and store it in array
//NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:response];
}