难以解析RSS提要

Jac*_*ies 1 iphone cocoa objective-c ipad ios

我正在尝试使用解析RSS提要(http://www.themostunrealbeats.com/?feed=rss2)NSXMLParser.我很难找到文章中的图片.这是图片在RSS提要中的位置.

<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>
Run Code Online (Sandbox Code Playgroud)

具体来说,我想要http://themostunrealbeats.files.wordpress.com/2012/03/madeon.png.然而在委托方法中NSXMLParser,我找不到任何东西.

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

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

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

    }

}
Run Code Online (Sandbox Code Playgroud)

string没有价值.我怎么解析这个?

Dip*_*ara 5

// 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.
Run Code Online (Sandbox Code Playgroud)