Re: NSURLRequest or alternative & structuring data for use with NSBrowser? (Total Noob questions...)
Re: NSURLRequest or alternative & structuring data for use with NSBrowser? (Total Noob questions...)
- Subject: Re: NSURLRequest or alternative & structuring data for use with NSBrowser? (Total Noob questions...)
- From: Brian Smith <email@hidden>
- Date: Fri, 4 May 2007 10:57:42 -0600
Hi Cliff,
On May 4, 2007, at 9:23 AM, Cliff Pruitt wrote:
1. What object is best to use for a single HTTP request? I've
looked at NSURLRequest, NSURLConnection, NSURLDownload, etc... and
I've read through the "URL Loading System" docs. I sort of get
parts of it, but it doesn't seem clear about how all the pieces fit
together and what each piece is intended to specifically do.
You are probably best of using the initializer for NSString or NSData
that will populate themselfs with the contents from a URL, then you
get an object loaded with the content for parsing. I would suggest
NSString's - (id)initWithContentsOfURL:usedEncoding:error: method if
your not concerned with Mac OS X versions. You can use NSScanner to
parse it. Also, look at Web Kit to see if something would work for you.
2. Is it best to download the text to memory and load it into
another object, or DL to a temp directory and then read the file
back in with something, say to parse XML?
The above sort of answers this. There is a class NSXMLParser for
parsing XML.
3. WHat is the best way to model hierarchical data for use with
NSBrowser? Is there an accepted "best way" of doing it? Dumping
everything into an array containing arrays within arrays seems...
convoluted at best.
A tree structure. The "best way" is something somebody else can
answer and I think it depends on you data. Arrays of arrays are
basically a tree structures. NSDictionary is basically implemented
using trees, so it usually a good choice for a container for NSBrowser.
I hope this helps.
Brian
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden