Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-18-2010, 10:43 AM   #1 (permalink)
Awesome
 
Esko2300's Avatar
 
Join Date: Jun 2009
Location: New York, N.Y.
Posts: 389
Esko2300 is on a distinguished road
Default Need advice on parsing information techniques

IM wondering what is the correct way to parse information, using a NSURLConnection and its delegates, and then loading it up to the view within the object i created and not on the viewController. I orginally created a new NSObject for my parser and then inside the parser i would manipulate the view through the delegate to get my desired results. That was my first application, now im thinking it might be more efficant to just place the starting parsing function and its delegates inside the viewcontroller and then manipulate the view as needed. Any insights into which would be a more efficant way of doing this will be really helpfull
Esko2300 is offline   Reply With Quote
Old 08-18-2010, 11:48 AM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

Here's how I approach this:

I always create a custom subclass of NSXMLParser that will also be the delegate for itself. All of the parsing logic is self-contained within this class.

I create a custom object to store the information from within the feed. For example
Code:
<EventList>
   <Event id="1">
      <Name>Event1</Name>
      <Time>Right Now</Time>
      <Location>Somewhere</Location>
      ...
   </Event>
   <Event id="2">
      ...
   </Eevnt>
</EventList>
In this example, I would create a custom object "Event" that would have properties for ID, Time, Location and wahtever else.

So during parsing, I would populate an array with all of these custom objects.
In my parser class, I would make that array a property so that it can be accessed from elsewhere.

After parsing, I take the array of custom objects that was parsed from the xml parser class. I then pass that array around to any view controller classes that need access to the data.

Edit: Of course my example is XML but this approach can be extrapolated to any type of format.

Last edited by smithdale87; 08-18-2010 at 11:51 AM.
smithdale87 is offline   Reply With Quote
Old 08-18-2010, 12:16 PM   #3 (permalink)
Awesome
 
Esko2300's Avatar
 
Join Date: Jun 2009
Location: New York, N.Y.
Posts: 389
Esko2300 is on a distinguished road
Default

Well your method is what i do when i need to load up the viewcontroller and it works fine. I have a struct with a few arrays that hold the title's , inventory number's ect for all my variables. But my problem lies when grabbing more data for the user, the user can have up to and more 1000 plus objects. What i do is parse mabye 20 objects at a time and at the end of my tableview i have a row if pressed will parse more information(sort of like in the mail app). So when i need to grab more info ive already loaded the viewcontroller im already in, which is why i need to be able to reload the data within the parser when i grab more data. I already have this working fine cause i have an instance of a tableview,which i set to whichever viewcontrollers tableview when loaded, within the struct im using to populate the tableview within the controller. But im pretty sure this is not a efficiant way of completing this process
Esko2300 is offline   Reply With Quote
Reply

Bookmarks

Tags
nsurlconnection, parsing, parsing techniques, soap, xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 347
5 members and 342 guests
freewind, givensur, lendo, Newbie123, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:53 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0