Reputation: 508
I need to parse the rss feed from feed://feeds.huffingtonpost.com/huffingtonpost/LatestNews.
But, I could not read Link
tag of data because it doesn't have separate start and end tag.
<link id="apple-rss-icon" rel="icon" href="file://localhost/System/Library/Frameworks/PubSub.framework/Versions/A/Resources/PubSubAgent.app/Contents/Resources/favicon.tif" type="image/x-icon" />
I am using NSXMLParser
class with following methods.
(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:
(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
(void)parserDidStartDocument:(NSXMLParser *)parser
(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
Upvotes: 1
Views: 1426
Reputation: 1813
There are a couple of rss parser implementations available. E.g https://github.com/mwaterfall/MWFeedParser Maybe you can use this or get some inspiration from it.
Upvotes: 2
Reputation: 1007
Non-paired tags such as what you're showing will still fire NSXMLParser
events and you can access the element's attributes inside the didStartElement
method.
For an example of a pretty full-featured Objective-C RSS parser, check out MWFeedParser.
Upvotes: 2