Here I am getting xml response in temp string. I need to get one tag value from that xml response.
-(void) httpDataDidFinishLoadingWithData:(NSData *)theData
{
m_activityLoaded=NO;
temp=[[NSString alloc] initWithData:[dataLoader httpData] encoding:NSUTF8StringEncoding];
NSLog(@"TEMP IS TEMP %@", temp);
parser=[[NSXMLParser alloc] initWithContentsOfURL:[NSURL URLWithString:temp]];
[parser setShouldProcessNamespaces:NO];
[parser setShouldReportNamespacePrefixes:NO];
[parser setShouldResolveExternalEntities:NO];
parser.delegate=self;
[parser parse];
}
The problem is DidStartElement is not even calling after the above parser allocation and ready to parse.
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict
{
if(![elementName isEqual:@"Result"])
return;
woeid = [attributeDict objectForKey:@"woeid"];
NSLog(@"woeid %@", woeid);
}
My XML RESPONSE IS
<?xml version="1.0" encoding="UTF-8"?>
<Body><woied></woied></Body>
Please help me out of this guys. Thanks in Advance
You can try this :
I think this may be work.You were passing wrong data to parser.