Jack Humphries
Jack Humphries

Reputation: 13267

Difficulty parsing RSS feed

I'm trying to parse an RSS feed (http://www.themostunrealbeats.com/?feed=rss2) using NSXMLParser. I am having difficulty finding the picture in the article. Here is where the picture is in the RSS feed.

<media:content url="http://themostunrealbeats.files.wordpress.com/2012/03/madeon.png?w=400" medium="image">
    <media:title type="html">madeon</media:title>
</media:content>

Specifically, I want http://themostunrealbeats.files.wordpress.com/2012/03/madeon.png. Yet in the delegate method for NSXMLParser, I don't find anything.

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {

    if ([element isEqualToString:@"media:content"]) {

        NSLog(@"%@", string);
        [content appendString:string];

    }

}

string has no value. How can I parse this?

Upvotes: 1

Views: 317

Answers (1)

Dipen Panchasara
Dipen Panchasara

Reputation: 13600

// NSXMLParser has a following method
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict

// In this method parameter 'attributeDict' will return you all the sub attributes of main attribute.
// In your case its 'url' of Picture.

// I hope this will help you. Check this out.

Upvotes: 5

Related Questions