Is there a way to break NSXMLParser on a condition?
I have a simple question about nsxmlparser.
This is my snippet
- (void) parser: (NSXMLParser *) parser foundCharacters: (NSString 开发者_运维知识库*) string{
[...]
if ([currentElement isEqualToString:@"openpos"]) {
if ([string isEqualToString:@"0"]) {
// I WOULD EXIT FROM LOOP HERE!
return;
}
}
[...]
}
why this return doesn't work?
I need to exit from parser method and return back to my class with an error! I need to force an exception? or there is a better way to break parser loop?thanks,
albertoTry [parser abortParsing]; before return;
From the docs: If you invoke this method, the delegate, if it implements parser:parseErrorOccurred:, is informed of the cancelled parsing operation.
精彩评论