objective c - NSArray atomfeed and categories -
I have an at-speed with which all articles are being successfully parsed, but now I have a feed in the There are also categories as tags.
How can I parse Atom XML so that the categories in the Root Array and the filters of each category are included in an array with related articles.
Thank you, Bing
If I understand you correctly, Near a NSArray
(What you did not say about Atom feed items, I think that NSDictionary
), each has a category. What you want is a structure that groups items according to categories in the NSArray
s.
The appropriate data structure, in my opinion, is a NSDictionary
category categories on the arrays of items, here's how I can do it:
NSMutableDictionary * itemsByCategory = [NSMutableDictionary Dictionary]; (All objects in NSDictionary * items) {NSString * Category = [Object objectForKey: @ "Category"]; NSMutableArray * Category Items = [itemsByCategory Item ForKey: Category]; // If you do not have a category then you want to check some. If (CategoryItems) {Category Items = [NSMutableArray array]; [Itembicarbet set object: category kike: category]; } [Category addObject: item]; }
Comments
Post a Comment