我是 iPhone 的新手开发人员。我正在做简单的 xml 解析演示。我想我怎样才能得到遵循 xml 代码的图像???
<item>
<title>Rain washes out England qualifier</title>
<description>England's World Cup qualifier against Poland is postponed because of a waterlogged pitch and is rescheduled for 16:00 BST on Wednesday.</description>
<link>http://www.bbc.co.uk/sport/0/football/19941036</link>
<guid isPermaLink="false">http://www.bbc.co.uk/sport/0/football/19941036</guid>
<pubDate>Tue, 16 Oct 2012 21:18:26 GMT</pubDate>
<media:thumbnail width="66" height="49" url="http://news.bbcimg.co.uk/media/images/63530000/jpg/_63530879_016250328-1.jpg"/>
<media:thumbnail width="144" height="81" url="http://news.bbcimg.co.uk/media/images/63529000/jpg/_63529179_016250328-1.jpg"/>
</item>
我怎样才能得到图像?
我已经使用以下代码获得了标题或描述。
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
if([elementName isEqualToString:className])
{
[items addObject:item];
[item release];
item = nil;
}
else
{
if([currentNodeContent length] != 0)
{
if([className isEqualToString:@"item"])
{
if([elementName isEqualToString:@"title"]|| [elementName isEqualToString:@"description"] || [elementName isEqualToString:@"url"])
{
[item setValue:currentNodeContent forKey:currentNodeName];
if ([elementName isEqualToString:@"media:thumbnail"])
{
[item setValue:currentNodeContent forKey:@"url"];
}
}
else
{
}
}
}
else
{
}
}
[currentNodeContent release];
currentNodeContent = nil;
[currentNodeName release];
currentNodeName = nil;
}
提前致谢。