To send request to server to download data I am using NSOperation.After receiving data I am using NSXMLParser to parse response but it is not calling parser delegate methods such
-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
or
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
Can anyone tell where I am doing wrong.
//Creating NSOperation as follows:
NSOperationQueue *operationQueue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(createRequestToGetData) object:nil];
[operationQueue addOperation:operation];
[operation release];
-(void)createRequestToGetData
{
NSError *error;
NSURL *theURL = [NSURL URLWithString:myUrl];
NSData *data = [NSData dataWithContentsOfURL:theURL];
MyXMLParser *theXMLParser = [[MyXMLParser alloc]init];
NSError *theError = NULL;
[theXMLParser parseXMLFileWithData:data parseError:&theError];
NSLog(@"Parse data:%@",theXMLParser.mParsedDict); //Cursor is not coming here.
[theXMLParser release];
}
Note: MyXMLParser is subclass of NSObject which implement Parser delegates methods but my cursor is not reaching at NSLog.When placed debug point in Parser delegate methods found that those methods are not getting called.
Can anyone tell where is the problem and how I can resolve this.
Thanks in advance!