Re: NSDictionary and XML-format property lists
Re: NSDictionary and XML-format property lists
- Subject: Re: NSDictionary and XML-format property lists
- From: Luke Adamson <email@hidden>
- Date: Tue, 19 Jun 2001 08:29:40 -0700
On Tuesday, June 19, 2001, at 04:06 AM, Bill Cheeseman wrote:
Why doesn't NSDictionary have a 'description...' method named something
like
'descriptionInXMLFormat'?
You probably want something along these lines:
@implementation NSDictionary (YourExtensions)
- (NSData *)xmlDataRepresentation;
{
return (NSData *)CFPropertyListCreateXMLData(NULL, self);
}
- (NSString *)xmlDescription;
{
// I actually have no idea what CFPropertyListCreateXMLData trickles
down to in terms of string encoding. UTF-8 is a guess.
return [NSString stringWith
Data:[self xmlDataRepresentation]
encoding:NSUTF8StringEncoding];
}
@end
---
Luke