iOS NSXMLPARSER在RSS Feed中解析媒体内容标记

我正在使用NS XMLParser来解析RSS提要.早些时候我正在使用来自cdata块的图片网址,但现在我遇到了一个内部有图片网址的Feed
<media:content url="http://cdn.example.com/wp-content/uploads/2013/10/article-2462931-18C5CBC000000578-776_634x452.jpg" medium="image"/>

如何从此标记中选择图像网址?这是我想在didStartElement方法中使用但它无法正常工作:

if ([elementName isEqual:@"media:content"])
    {
        currentString = [[NSMutableString alloc] init];

        // Basically i need the image url string at this point             

        Nsstring *imageURLString = [self getFirstimageUrl:currentString];
        imageURL = [NSURL URLWithString:imageURLString];
        [self downloadThumbnails:imageURL];
    }

如何从媒体内容标签中选择图片网址字符串?谢谢!

解决方法

我没有收到任何答案,但在尝试不同的事情后,我能够解决这个问题.我现在正在回答我自己的问题,所以如果有人面临同样的问题,他们可以解决这个问题,而不会像我那样浪费太多时间.

在NSXMLParser的didStartElement方法中,我写了以下内容

if ([elementName isEqual:@"media:content"])
    {
        Nsstring *imageURLString = [attributeDict objectForKey:@"url"];
        NSLog(@"imgurL %@",imageURLString);

        // Here you can use the imageURLString to download the image
    }

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...