Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- how to get the modelClass objects and store it into an array in RssFeedParsing
- NSLog(@"parserDidStartDocument");
- if ([elementName isEqualToString:@"item"]) {
- modClass = [[ModalClass alloc] init];
- boolItem = YES;
- }
- if(boolItem)
- {
- if([elementName isEqualToString:@"title"])
- {
- boolTitle = TRUE;
- titleString = [[NSMutableString alloc]init ];
- }
- if([elementName isEqualToString:@"description"])
- {
- boolDescription = TRUE;
- descriptionString = [[NSMutableString alloc]init ];
- }
- if([elementName isEqualToString:@"link"])
- {
- boolLink = TRUE;
- linkString = [[NSMutableString alloc]init ];
- }
- if([elementName isEqualToString:@"pubDate"])
- {
- boolPubDate = TRUE;
- pubDateString = [[NSMutableString alloc]init ];
- }
- }
- if(boolTitle)
- {
- [titleString appendString:string];
- NSLog(@"the titles is %@",titleString);
- }
- if(boolDescription)
- {
- [descriptionString appendString:string];
- }
- if(boolLink)
- {
- [linkString appendString:string];
- }
- if(boolPubDate)
- {
- [pubDateString appendString:string];
- }
- if([elementName isEqualToString:@"title"])
- {
- if(titleString){
- modClass.title = [[NSString alloc]initWithString:titleString];
- }
- NSLog(@"the value in modclass.title is %@",modClass.title);
- boolTitle = FALSE;
- }
- if([elementName isEqualToString:@"description"])
- {
- if(descriptionString) {
- // modClass.description = [[NSString alloc]initWithString:descriptionString];
- }
- boolDescription = FALSE;
- }
- if([elementName isEqualToString:@"link"])
- {
- if(linkString) {
- modClass.link = [[NSString alloc]initWithString:linkString];
- }
- boolLink = FALSE;
- }
- if([elementName isEqualToString:@"pubDate"])
- {
- if (pubDateString) {
- modClass.pubDate = [[NSString alloc]initWithString:pubDateString];
- NSLog(@"the value in modclass.published date is %@",modClass.pubDate);
- }
- boolPubDate = FALSE;
- }
- if([elementName isEqualToString:@"item"])
- {
- boolItem = FALSE;
- [array addObject:modClass];
- }
- int nodeCount=[array count];
- NSLog(@"the array count is %i",nodeCount);
- for(int i=0;i<nodeCount;i++)
- {
- NSLog(@"title %@",modClass.title);
- NSLog(@"link %@",modClass.link);
- NSLog(@"description %@",modClass.description);
- NSLog(@"pubDate %@",modClass.pubDate);
- }
Add Comment
Please, Sign In to add comment