Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top