user717452
user717452

Reputation: 111

iOS Parse XML iTunes:image tag

I am trying to parse a podcast to build a table view of its contents in my app. The picture for the podcast is in a tag listed as:

<itunes:image href="http://www.site.com/picture.jpg" />

In my app, I try to get the contents of the string using:

 NSString *articleImage = [item valueForChild:@"itunes:image"];

When I run a log for this string, nothing shows up. So, how would I go about getting the URL of the jpg from this particular tag?

Upvotes: 1

Views: 345

Answers (1)

Matt Fellows
Matt Fellows

Reputation: 6532

The url is in an attribute called href, valueForChild gets the text value of the element, which is quite correctly empty. You want to use [item attributeForName:@"href"] where item is your itunes:image element.

Upvotes: 3

Related Questions