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: Cliff Pruitt <email@hidden>
- Date: Fri, 4 May 2007 15:02:37 -0400
On May 4, 2007, at 12:59 PM, Brian Smith <email@hidden> wrote:
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.
I'd say thats one of my problems will getting up to speed. There are
so many different classes its hard to read through them all. I've
been working on a "look it up as I need it" and never even thought
NSString would have the ability to fetch something from the net. I
just thought it'd be from a local file URL.
The above sort of answers this. There is a class NSXMLParser for
parsing XML.
I knew Cocoa had XML support but hadn't gotten to that stage. I just
didn't know if there was an easier format. For example, I spend a
lot of my time doing web programming and with client side HTTPRequest
stuff its usually a lot easier to handle a JSON response than it is
to parse XML.
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.
NSDictionary might work well. Every "leaf" in a column would be
uniquely named and a dictionary would be a good way of storing that.
I just kind of need to work out how to correlate that to an
NSBrowser, but I guess thats just part of the learning process.
I hope this helps.
Absolutely seems like it should. :-) Thanks!
_______________________________________________
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