/* Parse data as a property list Original Source: (See copyright notice at ) */ /* Load up some data as a property list. Similar to [NSDictionary dictionaryWithContentsOfFile:path] but uses text as the input. Based on snippet of code courtesy of Ken Dyke; See "What is the easiest way to get an XML Plist into an NSDictionary?" on macosx-dev@omnigroup.com */ - (id)propertyListFromXMLWithOptions:(CFPropertyListMutabilityOptions)options { CFPropertyListRef pList; CFStringRef errorString = nil; pList = CFPropertyListCreateFromXMLData(NULL, (CFDataRef)self, options, &errorString); if(errorString) { NSLog(@"Error loading from Property List:%@",(NSString*)errorString); CFRelease(errorString); } return [(id)pList autorelease]; } /*" Return a property list from the data. Functions similarly to #{[NSDictionary dictionaryWithContentsOfFile:path]}. "*/ - (id)propertyListFromXML { return [self propertyListFromXMLWithOptions:kCFPropertyListImmutable]; } /*" Return a mutable property list from the data. "*/ - (id)mutablePropertyListFromXML { return [self propertyListFromXMLWithOptions:kCFPropertyListMutableContainersAndLeaves]; }