code_junkie

Handling RSS Tags with NSXMLParser for iPhone

Nov 13th, 2011
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
  2. NSLog(@"ended element: %@", elementName);
  3. if ([elementName isEqualToString:@"item"]) {
  4. // save values to an item, then store that item into the array...
  5. [item setObject:currentTitle forKey:@"title"];
  6. [item setObject:currentLink forKey:@"link"];
  7. [item setObject:currentSummary forKey:@"summary"];
  8. [item setObject:currentDate forKey:@"date"];
  9. [item setObject:currentImage forKey:@"media:thumbnail"];
  10.  
  11. <item><title>Knife robberies and burglaries up</title>
  12. <description>The number of robberies carried out at knife-point has increased sharply and burglaries are also up, latest crime figures indicate</description>
  13. <link>http://news.bbc.co.uk/go/rss/-/1/hi/uk/7844455.stm</link>
  14. <guid isPermaLink="false">http://news.bbc.co.uk/1/hi/uk/7844455.stm</guid>
  15. <pubDate>Thu, 22 Jan 2009 13:02:03 GMT</pubDate><category>UK</category>
  16. <media:thumbnail width="66" height="49" url="http://newsimg.bbc.co.uk/media/images/45400000/jpg/_45400861_policegeneric_pa.jpg"/>
  17. </item>
  18.  
  19. parser:didStartElement:namespaceURI:qualifiedName:attributes:
Add Comment
Please, Sign In to add comment