Re: Noob question in regards to NSXMLParser
Re: Noob question in regards to NSXMLParser
- Subject: Re: Noob question in regards to NSXMLParser
- From: "Eric E. Dolecki" <email@hidden>
- Date: Tue, 07 Jun 2011 14:11:08 -0400
This is for iOS. I've used XPath in other languages and it's totally
awesome. So I am using some flags and a counter to get things done... feels
like a total hack, but it's working.
Sorry, I'll specify in the future for sure...
Google Voice: (508) 656-0622
Twitter: eric_dolecki XBoxLive: edolecki PSN: eric_dolecki
http://blog.ericd.net
On Tue, Jun 7, 2011 at 2:03 PM, Jens Alfke <email@hidden> wrote:
>
> On Jun 7, 2011, at 7:03 AM, Eric E. Dolecki wrote:
>
> > What I am really after is the current_conditions data. How can one
> specify
> > WHERE in the XML to use the attributes from? A lot of the information is
> > repeated in other nodes so I can't just check (if([elementName
> > isEqualToString:@"condition"]){) , how can I check if the current
> element is
> > within a specific tag? (In this case the parent is current_conditions)?
>
> You _totally_ want to use XPath for this. It lets you write a simple query
> string that fetches arbitrarily nested data. What you’re asking for is a
> one-liner. There is a little bit of a learning curve for learning the
> syntax, but it’s really worth it (you can find online tutorials pretty
> easily by searching.)
>
> So instead of NSXMLParser, use the higher level NSXMLDocument (which can
> even fetch the URL for you) and then use the XPath methods on it.
>
> [Um, except now it occurs to me that you didn’t specify what OS you’re on,
> and last I heard iOS didn’t have NSXMLDocument yet… If you’re using iOS,
> it’s best to specify that explicitly, since a lot of us old crusties here
> will assume OS X unless otherwise stated.]
>
> —Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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