i have 4 NSXMLParser objects.they work fine when i use them for first time but when i use them more than once they fail but return no error code
initialization
-(void)initParsers
{
NSURL* file_url = nil;
FOR(i,4){
file_url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"stack%d",0]ofType:@"xml" inDirectory:@"stackXmls"]];
stackXmlParser[i] = [[NSXMLParser alloc] initWithContentsOfURL:file_url];
stackXmlParser[i].delegate = self;
}
}
Parse
BOOL success = [stackXmlParser[currentStack] parse];
if (success)
{
//Do XML stuff
...
} else {
NSLog(@"Error Error Error!!!");
NSError *error = [stackXmlParser[currentStack] parserError];
NSLog(@"Errors with xmlParser: %@ %d", [error localizedDescription], error.code);
}
OUTPUT
2012-01-24 16:03:29.542 Cards[5168:207] Error Error Error!!!
2012-01-24 16:03:29.543 Cards[5168:207] Errors with xmlParser: (null) 0
Try using initWithData instead of initWithContentsOfURL
Output