I have the following code,
NSString *string = "Some value";
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
self.parser = [[NSXMLParser alloc] initWithData:data];
self.parser.delegate = self;
[self.parser parse];
After I call "parse" method it immediately calls the delegate parseErrorOccurred
and then calls delegate parserDidEndDocument
.
I want only one method to be called.
Thanks in advance.
That delegate method is called when there is a fatal error, so there is an issue with the XML you are parsing.
The method has an
NSError
parameter, and that should give you a clue as to what is wrong with the XML.