Hello,
I've managed to parse details from a blog post and I'm trying to save them to an array and then to a database. The code is below:
Code:
Code:
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
//NSLog(@"ended element: %@", elementName);
if ([elementName isEqualToString:@"item"]) {
//Stephen Start
//NSFetchRequest *request = [[NSFetchRequest alloc] init];
//NSEntityDescription *entity = [NSEntityDescription entityForName:@"Tabrss" inManagedObjectContext:managedObjectContext];
//[request setEntity:entity];
//NSError *error;
Tabrss *newTAB_RSS = [NSEntityDescription
insertNewObjectForEntityForName:@"Tabrss"
inManagedObjectContext: self.managedObjectContext];
//Stephen Stop
// save values to an item, then store that item into the array...
[item setObject:currentTitle forKey:@"title"];
[item setObject:currentLink forKey:@"link"];
[item setObject:currentSummary forKey:@"summary"];
[item setObject:currentDate forKey:@"date"];
//newTAB_RSS.xtitle = [item setObject:currentTitle forKey:@"title"];
//newTAB_RSS.xlink = currentLink forKey:@"link";
//newTAB_RSS.xsummary = currentSummary;
//newTAB_RSS.xdate = currentDate;
//[item setObject:currentTitle forKey:@"title"];
//[item setObject:currentLink forKey:@"link"];
//[item setObject:currentSummary forKey:@"summary"];
//[item setObject:currentDate forKey:@"date"];
//Stephen Start
[stories addObject:[item copy]];
[stories addObject:newTAB_RSS];
I've been playing around with it a bit, but can't manage to get it working. How do I assign values from the ITEM to my STORIES array. The line "[stories addObject:newTAB_RSS];" should then write it to the database.
Thanks in advance for the help.
Regards,