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 845101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:23:36+00:00 2026-05-15T06:23:36+00:00

I am struggling with the correct design for the delegates of nsxmlparser. In order

  • 0

I am struggling with the correct design for the delegates of nsxmlparser.

In order to build my table of Foos, I need to make two types of webservice calls; one for the whole table and one for each row. It’s essentially a master-query then detail-query, except the master-query-result-xml doesn’t return enough information so i then need to query the detail for each row. I’m not dealing with enormous amounts of data.

Anyway – previously I’ve just used

NSXMLParser *parser = [[NSXMLParser alloc]init];
[parser setDelegate:self];
[parser parse];

and implemented all the appropriate delegate methods in whatever class i’m in.
In attempt at cleanliness, I’ve now created two separate delegate classes and done something like:

NSXMLParser *xp = [[NSXMLParser alloc]init];
MyMasterXMLParserDelegate *masterParserDelegate = [[MyMasterXMLParser]alloc]init];
[xp setDelegate:masterParserDelegate];
[xp parse];

In addition to being cleaner (in my opinion, at least), it also means each of the -parser:didStartElement implementations don’t spend most of the time trying to figure out which xml they’re parsing.

So now the real crux of the problem.

Before i split out the delegates, i had in the main class that was also implementing the delegate methods, a class-level NSMutableArray that I would just put my objects-created-from-xml in when -parser:didEndElement found the ‘end’ of each record.

Now the delegates are in separate classes, I can’t figure out how to have the -parser:didEndElement in the ‘detail’ delegate class “return” the created object to the calling class. At least, not in a clean OO way. I’m sure i could do it with all sorts of nasty class methods.

Does the question make sense?
Thanks.

  • 1 1 Answer
  • 1 View
  • 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-15T06:23:37+00:00Added an answer on May 15, 2026 at 6:23 am

    The question does make sense (and so does the split). If I understand things right, you could simply add a result array property to the detail parser delegate and read this property from the caller after you call [xp parse]?

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

Sidebar

Related Questions

I am struggling to make a decision regarding the correct organisation for a web
I am struggling to find out the syntactically correct way in which to add
Hi I'm struggling to find the correct approach on SO for what I am
I am struggling to work out the correct MySQL syntax to add the result
I'm struggling with checking the validity of version numbers in Perl. Correct version number
I am currently struggling with the correct data format to use with Cassandra. I
I am struggling to figure out the correct control to use for a list
I'm really struggling here, and it's holding me back. What is the correct way
Design wise, I am struggling with where to keep items I use on the
I've been struggling with this problem for two weeks now. I've searched all over

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.