Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 786211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:00:17+00:00 2026-05-14T21:00:17+00:00

I have created a RSS parser and 3 TableViews and it parses the RSS

  • 0

I have created a RSS parser and 3 TableViews and it parses the RSS files fine but I don’t know how to notify the TableViewController when parsing has ended so it can update the view.
The TableViewController initiates the parser and the parsing of a feed.

parser = [[RSSParser alloc] initWithURL:@"http://randomfeed.com"];

I can access the single feed items like

[parser feedItems];

In parser.m i have implemented the delegate methods of NSXMLParser:

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
- (void)parserDidEndDocument:(NSXMLParser *)parser 

So how do i get parserDidEndDocument to notify my controllers so i can add the data to the tableview.

Cheers from a obj-c beginner.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:00:18+00:00Added an answer on May 14, 2026 at 9:00 pm

    Ok the delegation pattern is widely used in the Cocoa framework.

    The file that parses data must have a protocol, anyone wanting callbacks form this
    Class must implement the methods from the protocol:

        //XMLParser.h
    
        //import statements here ..
    
        @protocol XMLParserDelegate
    
        - (void) parserDidFinish:(NSArray*) theParsedData; //have as many methods as you please, didFail, doingProgress etc.
    
        @end
    
        @interface XMLParser : NSObject {
    
        id <XMLParserDelegate> delegate; //we don't know what type of object this will be, only that it will adhere to the XMLParserDelegate protocol.
    
        }
    
    @property(assign) id delegate;
        //methods
    
        @end
    

    In the implementation of the XMLParser:

    @implementation XMLParser
    
    @synthesize delegate;
    
    - (void)parserDidEndDocument:(NSXMLParser *)parser {
    
    [self.delegate parserDidFinish:dataYouCollectedArray]; //this is where it happens.
    
    }
    

    So in your controllers interface file you says that you will adhere to the XMLParserDelegate protocol.

    //MyController.h
    
    #import "XMLParser.h"
    
    @interface MyController : UIViewController <XMLParserDelegate> { //this is where you "promise" to implement the methods of the protocol.
    
    }
    

    In the MyController.m file you now instantiate the XMLParser.

    @implementation MyController
    
    - (void) init {
    XMLParser *parser = [[XMLParser alloc] init];
    [parser setDelegate:self] //now the parser has a reference to this object.
    [parser start];
    
    }
    
    - (void) parserDidFinish:(NSArray*) results {
    
    //now you have your results in the controller, can set it as the data source of the tableView and call tableView.reloadData;
    }
    

    This is a great pattern that loosely couples the caller and responder without having them know anything other that what the protocol dictates, about each other.

    If I have a view element that is confined to its own functionality, like, say, a clock.
    I would have a ClockViewController and it would instantiate arm, dials, etc. They would all be linked to the clock and alert the clock controller about their actions using this pattern. This way I can use the clock arm or dial in other code as I please, as long as the object instantiating them adheres to the ClockArmDelegate protocol.

    Hope it makes sense:) it is the, Im pretty sure, most used pattern in Cocoa.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a UserControl that has a ListView in it. The ListView is
I have an application that reads an rss feed, parses the xml and adds
I have a WCF service that uses a System.ServiceModel.Syndication.SyndicationFeed to create an RSS feed.
Have created a c++ implementation of the Hough transform for detecting lines in images.
I have created a template for Visual Studio 2008 and it currently shows up
I have created a custom dialog for Visual Studio Setup Project using the steps
I have created a PHP-script to update a web server that is live inside
I have created a C# class file by using a XSD-file as an input.
I have created a few small flash widgets that stream .mp3 audio from an
i have created a workflow activity that do give the item creater of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.