In my
- (void)parser:(NSXMLParser *)parser
didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict {
// ...
}
I check to see if one of my XML attributes is equal to a value I store in my plist. If it’s not then I want it to execute normally and get the latest information. If it is the same value though I don’t want to waste the processing time of getting all the data again. So if I have code like below how can I terminate the parsing process if the values are the same?
if (lastUpdated == [attributeDict valueForKey:@"last_updated"]) {
// Terminate the xml parsing because data is up to date
}
You can use
[parser abortParsing]but note that this is intended for XML errors rather than “I don’t want this data” situations and can cause yourparser:parseErrorOcurred:method to be called a couple of times, in my experience.