Re: XML to Plist
Re: XML to Plist
- Subject: Re: XML to Plist
- From: Peter Lübke <email@hidden>
- Date: Tue, 28 Dec 2010 23:25:06 +0100
Hi Sandro,
just to mention it (this has nothing to do with your original question):
Why don't you create your NSMutableDictionary with
[NSMutableDictionary dictionary] ?
This produces exactly the same result as [[[NSMutableDictionary
alloc] init] autorelease] -
practically all Cocoa CLASS methods that create objects return newly
allocated, inited and autoreleased objects unless otherwise stated in
the docs.
Best regards,
Peter
Am 28.12.2010 um 19:34 schrieb Sandro Noël:
- (NSDictionary *) plist{
NSMutableDictionary *resultDict = [[[NSMutableDictionary alloc]
init] autorelease];
if ([self hasChildren]){
NSMutableDictionary *child = [[[NSMutableDictionary alloc]init]
autorelease];
for (OSXMLElement *element in _children){
[child addEntriesFromDictionary:[element plist]]; }
[resultDict setValue:child forKey:_elementName];
}
else {
[resultDict setValue:_elementText forKey:_elementName];
}
return resultDict;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden