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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:34:20+00:00 2026-06-11T14:34:20+00:00

in my application i need to do several HTTP requests. All those requests return

  • 0

in my application i need to do several HTTP requests. All those requests return XML-Documents which need to be parsed and then go into table views or whatever… It’s about 10-20 Documents throughout the whole application. Attributes with the same name can occur in different documents so i need to differentiate these in my delegate methods.

My approach was to have only 1 class with the NSXMLParserDelegate methods, using different parsers per document (but with the same delegate) and differentiate between the parsers (aka documents) using the parser-argument in the delegate methods. but this is getting quite complex and i don’t wanna end up with tons of different parser-instance-variables and if clauses.
isn’t there a simpler way to do this? i thought of having 1 class per parsing operation (=> different delegates), but i guess that’s even worse..

  • 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-06-11T14:34:22+00:00Added an answer on June 11, 2026 at 2:34 pm

    One option is to put the XML delegate callbacks and/or data construction methods on the object that will get created from parsing that specific xml type. That would place the definition of the object along with the knowledge of how to create it from xml or data chunks in one place. By trying to place all of the parsing logic for all types in one delegate methods it’s over complicates that one delegate class and splits the knowledge of each of the types you’re working with.

    The one challenge with that approach is composite objects. For example, if you have an artist object, an album object that contains an artist, and a call that gets a list of artists. One approach there is to have the composite object that’s parsing defer to that other object class (perhaps with your own protocol). For example, The album object is parsing and hits an “artist” element. So it knows to alloc an artist and as it hits data chunks from the delegate callbacks (until it hits close artist element) – it’s going to keep calling your protocol methods stuffing data into in. That defers the knowledge of what to do with that chunk of data to the class that defines that object. For a class that’s processing a list of artists it would have done this n times building up a list. A call that gets one artist (delegates on the artist class) would still call those sate data chunk stuffing methods on the artist object.

    Finally, constructing objects as the XML is parsed, if done right, can have the benefit of keeping memory lower and perform faster. In contrast buffering up the complete xml string, creating a full XML DOM can use more memory which can also be slower for the user. So, consider performance as well.

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

Sidebar

Related Questions

I need to send HTTP requests with all the standard RESTful methods and access
My iPhone application has several views and some viewControllers for that views. I need
for several reasons, in need to localize my application giving the possibility to the
For my Ruby on Rails application, I need the possibility to create several LectureNote
Almost all the activities in my application need to interact with a web server
I have an application that is performing HTTP Requests (specifically calling the FogBugz API)
In the QT application we develop we need to display several 'Viewer windows' (to
My application need to download several web-pages simultaneously and i know this is possible
We have several SQL scripts which are generated from an Entity Model. They need
I need an application to produce a PDF file using several different custom templates.

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.