Reputation: 3600
I am currently getting the title, date, and link for item in an RSS feed. I'm wanting to add the image for each item to my tableview cell and I know how to do that. The problem I'm having is figuring out how to get the url for the image.
The XML with the image URL looks like this:
<description><img src="http://images.cdn.bigcartel.com/bigcartel/product_images/128552379/max_h-300+max_w-300/LipsITUNES.jpg" title="The Lips- Album Numero Dos" align="left" style="margin:0 10px 10px 0;" />
Picking up where the previous album left off (self-titled, don't go looking for "Album Numero Uno") The Lips return with 12 new songs and their unique blend of indie garage rock.
Includes the single "Useless" and "My Name Is Suicide."</description>
This is also there:
<media:thumbnail height="75" url="http://images.cdn.bigcartel.com/bigcartel/product_images/128552379/max_h-75+max_w-75/LipsITUNES.jpg" width="75"/>
<media:description type="html">
Upvotes: 0
Views: 2156
Reputation: 31339
Use the didStartElement
delegate method.
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict{
if (nil != qualifiedName)
{
elementName = qualifiedName;
}
if ( [elementName isEqualToString:@"media:thumbnail"] )
{
self.currentItem.mediaUrl = [attributeDict valueForKey:@"url"];
}
}
Please check this for more details iPhone RSS Reader Application with source code
Upvotes: 4