How to parse the second child node from xml page in iphone
Posted
by Warrior
on Stack Overflow
See other posts from Stack Overflow
or by Warrior
Published on 2010-02-08T08:49:44Z
Indexed on
2010/04/08
7:13 UTC
Read the original article
Hit count: 274
I am new to iphone development.I want parse an you-tube XML page and retrieve its contents and display in a RSS feed.
my xml page is
<entry>
<id>xxxxx</id>
<title>xxx xxxx xxxx</title>
<content>xxxxxxxxxxx</content>
<media:group>
<media:thumbnail url="http://tiger.jpg"/>
</media:group>
</entry>
To retrieve the content i am using xml parsing.
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{
currentElement = [elementName copy];
if ([elementName isEqualToString:@"entry"]) {
entry = [[NSMutableDictionary alloc] init];
currentTitle = [[NSMutableString alloc] init];
currentcontent = [[NSMutableString alloc] init];
}
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
if ([elementName isEqualToString:@"entry"]) {
[entry setObject:currentTitle forKey:@"title"];
[entry setObject:currentDate forKey:@"content"];
[stories addObject:[entry copy]];
}}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
if ([currentElement isEqualToString:@"title"]) {
[currentTitle appendString:string];
} else if ([currentElement isEqualToString:@"content"]) {
[currentLink appendString:string];
}
}
I am able to retrieve id , title and content value and display it in a table-view.How can i retrieve tiger image URL and display it in table-view.Please help me out.Thanks.
© Stack Overflow or respective owner