From 827010cf875e54b373db5292bd643bca97116ca8 Mon Sep 17 00:00:00 2001 From: xoyip Date: Tue, 25 Feb 2014 14:10:01 +0900 Subject: [PATCH] handle ' tag in Atom --- Classes/MWFeedParser.m | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Classes/MWFeedParser.m b/Classes/MWFeedParser.m index 7d900ad..8fbb974 100644 --- a/Classes/MWFeedParser.m +++ b/Classes/MWFeedParser.m @@ -926,22 +926,25 @@ - (BOOL)createEnclosureFromAttributes:(NSDictionary *)attributes andAddToItem:(M // Process ATOM link and determine whether to ignore it, add it as the link element or add as enclosure // Links can be added to MWObject (info or item) - (BOOL)processAtomLink:(NSDictionary *)attributes andAddToMWObject:(id)MWObject { - if (attributes && [attributes objectForKey:@"rel"]) { - - // Use as link if rel == alternate - if ([[attributes objectForKey:@"rel"] isEqualToString:@"alternate"]) { - [MWObject setLink:[attributes objectForKey:@"href"]]; // Can be added to MWFeedItem or MWFeedInfo - return YES; - } - - // Use as enclosure if rel == enclosure - if ([[attributes objectForKey:@"rel"] isEqualToString:@"enclosure"]) { - if ([MWObject isMemberOfClass:[MWFeedItem class]]) { // Enclosures can only be added to MWFeedItem - [self createEnclosureFromAttributes:attributes andAddToItem:(MWFeedItem *)MWObject]; - return YES; - } - } - + if (attributes){ + if([attributes objectForKey:@"rel"]) { + + // Use as link if rel == alternate + if ([[attributes objectForKey:@"rel"] isEqualToString:@"alternate"]) { + [MWObject setLink:[attributes objectForKey:@"href"]]; // Can be added to MWFeedItem or MWFeedInfo + return YES; + } + + // Use as enclosure if rel == enclosure + if ([[attributes objectForKey:@"rel"] isEqualToString:@"enclosure"]) { + if ([MWObject isMemberOfClass:[MWFeedItem class]]) { // Enclosures can only be added to MWFeedItem + [self createEnclosureFromAttributes:attributes andAddToItem:(MWFeedItem *)MWObject]; + return YES; + } + } + } else if ([attributes objectForKey:@"href"]) { + [MWObject setLink:[attributes objectForKey:@"href"]]; + } } return NO; }