我正在使用nsxmlparser来读取苹果itunes rss feed..could,你们可以帮助读取这个特定的xml图像。
<im:image height="55">http://a1.phobos.apple.com/us/r1000/028/Music/5c/aa/fe/mzi.fsnbyjmf.55x55-70.jpg</im:image>下面是代码
 - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI: (NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary*) attributeDict
{           
        currentElement = [elementName copy];
    if ([elementName isEqualToString:@"entry"]) {
        // clear out our story item caches...
        item = [[NSMutableDictionary alloc] init];
        currentTitle = [[NSMutableString alloc] init];
        currentDate = [[NSMutableString alloc] init];
        currentSummary = [[NSMutableString alloc] init];
        currentLink = [[NSMutableString alloc] init];
        currentString=[[NSMutableString alloc] init];
        currentImage = [[NSMutableString alloc] init];
           currentContent=[[NSMutableString alloc]init];    
    }
    if ([attributeDict objectForKey:@"href"]) 
     {
     currentString=[attributeDict objectForKey:@"href"];
        NSLog(@"what is my current string:%@",currentString);
     [item setObject:currentString forKey:@"href"];
     }
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:   (NSString *)namespaceURI qualifiedName:(NSString *)qName{     
    if ([elementName isEqualToString:@"entry"]) {
        [item setObject:currentTitle forKey:@"title"];
        [item setObject:currentLink forKey:@"link"];
        [item setObject:currentSummary forKey:@"description"];
        [item setObject:currentDate forKey:@"published"];
        //[item setObject:currentImage forKey:@"im:image height=55"];
        NSLog(@"the current image content:%@",item);
        [stories addObject:[item copy]];
        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
        }
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
    //NSLog(@"found characters: %@", string);
    // save the characters for the current item...///////////element
    if ([currentElement isEqualToString:@"title"]) {
        [currentTitle appendString:string];
    } else if ([currentElement isEqualToString:@"link"]) {
        [currentLink appendString:string];
    } else if ([currentElement isEqualToString:@"description"]) {
        [currentSummary appendString:string];
    } else if ([currentElement isEqualToString:@"published"]) {
        [currentDate appendString:string];
    }
    else if ([currentElement isEqualToString:@"url"]) {
        [currentContent appendString:string];
    }
}发布于 2011-03-15 12:55:48
@user652878尝试此编码,它运行良好.....在didStartelement中,按如下方式编写..else if(elementName isEqualToString:@“媒体:内容”)
{
    currentImage = [attributeDict valueForKey:@"url"];
}在didEndElement,......else if(elementName isEqualToString:@“媒体:内容”){
              [item setObject:currentImage forKey:@"image"];
 }在可找到的字符中........................else if(currentImage isEqualToString:@“媒体:内容”){
    [currentImage appendString:string];
}使用NSLog查看我们是否获得了图像链接...当然你会得到你的解决方案。
https://stackoverflow.com/questions/5307543
复制相似问题