Q:

How to load only selected data from plist file

I have plist with Root as Array and then each item in this array is a Dictionary with objects: name(String) and surname(String). I want display all the names from my file. At the moment I am using this code:
   NSArray *myData = [[NSArray alloc] initWithContentsOfFile:mypath];
   NSMutableArray *names = [[NSMutableArray alloc] init];
   for (int i=0; i < myData.count; i++) {
       [names addObject:[[myData objectAtIndex:i] objectForKey:@"name"]];
   }

Is it any way that I could load values for the key @"name" straight from the plist file to NSMutableArray *names? I just don't want to load whole content of the plist file to memory if I only need @"name" values. 

A:

No. Loading a plist is an all-or-nothing affair. Unless your plist is massive I wouldn't worry about it. And if it is, then you would want to consider splitting it up into multiple files rather than doing something like writing your own plist deserializer (because I guarantee you that CoreFoundation's plist parser is going to be faster than yours).

