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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to