The is the fourth post in a series. The others are (here, here and here). We're reading XML today.
Actually, we've finished reading it and now we want to filter the elements to get just what we want. One thing of interest is the code for sorting all the keys in the dictionary (helpful for printing in debug phase). It seems like there should be an instance method for that in NSArray, but there isn't. The method is called
Since we're going to be writing to a plist, I substitute the string @"None" when a value is nil. Of course, if I ever come across a record with that as an authentic value, I'll be screwed. The correct way to do this for collection objects is to use NSNull, then process it appropriately when displaying to the screen. But you still can't save it in a plist. Probably, I should use @"TESpecialValueThatSimulatesNullAndCanBeStoredInAPlist". You'd never run into that in any other context.
That's it. I need to test this a lot more, and then try to build an app that will take a PMID (say by reference to a PubMed record shown in a browser view), fetch the XML, process it, and then display it nicely in the GUI. If I were sadistic I would try to build a lightweight alternative to Reference Manager. (Just look at that website---it's so ugly only a mother could love it). Many years ago, they basically destroyed my system with one of their early efforts and I've never used it since. But, the thing is, for such an app to be useful you'd have to interface with Microsoft Word. I may be sadistic but I'm not crazy!