Re: TBXML question
Re: TBXML question
- Subject: Re: TBXML question
- From: Jens Alfke <email@hidden>
- Date: Fri, 13 Jan 2012 19:37:01 -0800
On Jan 13, 2012, at 5:16 PM, Philip Vallone wrote:
> Have you considered using Libxml and xpath? Take a look at http://cocoawithlove.com/2008/10/using-libxml2-for-parsing-and-xpath.html.
libxml is very powerful but it’s also very low-level, and quite grungy to use. If there’s an Obj-C API available it’d be best to use that unless you’re 100% certain it won’t do what you need.
>> * TBXMLElement *playlist = [TBXML childElementNamed:@"playlist"
>> parentElement:element];*
>>
>> * while (playlist != nil) {*
>>
>> * NSLog(@"%@", [TBXML valueOfAttributeNamed:@"name"
>> forElement:playlist]); //infinite loop. how loop through all the playlists
>> for the user?*
>>
>> * } *
So, I haven’t used TBXML, but it looks like what you need is something like “playlist = playlist->nextSibling” at the bottom of the while loop. The DOM tree is chained together as a linked list of siblings at each level, a pretty typical approach.
—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