Hello i am having problem in xml parsing, here I am not able to get the value of the particular tag. My code is as follows:
- (void)viewDidLoad {
[super viewDidLoad];
NSString *feedURLString = @"http://www.google.com/ig/api?weather=new+york,ny";
NSURL *URL=[[NSURL alloc] initWithString:feedURLString];
NSString *data=[[NSString alloc] initWithContentsOfURL:URL
encoding:NSASCIIStringEncoding error:nil];
Element* root = [Element parseXML: data];
NSArray* resultnode = [root selectElements:@"forecast_information"];
for(Element *elementEntry in resultnode) {
NSString *city_Data = [[NSString alloc]init ];
//if([elementEntry isEqualToString:@"city_data"] )
city_Data = [[elementEntry selectElement:@"city data"]contentsText];
NSLog(@"city_Data======>>>>>%@",city_Data);
}
}
here i want the value of city data tag which has the value as New York, NY whenever i print the value of string it is always nil. Thansk in advance.