Re: NSFileWrapper with XML document
Re: NSFileWrapper with XML document
- Subject: Re: NSFileWrapper with XML document
- From: Michael Babin <email@hidden>
- Date: Sun, 28 Oct 2007 07:17:08 -0500
On Oct 27, 2007, at 9:49 PM, Rick Langschultz wrote:
Hello everyone,
I can't figure out why this is throwing an error:
- (NSFileWrapper *)fileWrapperRepresentationOfType:(NSString *)aType {
NSMutableDictionary *contents = [NSMutableDictionary dictionary];
NSXMLElement *rootElement = (NSXMLElement *)[NSXMLNode
elementWithName:@"document"];
NSXMLDocument *xmlDocument = [[NSXMLDocument alloc]
initWithRootElement:rootElement];
[contents setObject:xmlDocument forKey:[[NSString alloc]
initWithString:@"properties.xml"]];
NSFileWrapper *documentBundle = [[NSFileWrapper alloc]
initDirectoryWithFileWrappers:contents];
return [documentBundle autorelease];
}
The Error:
[Session started at 2007-10-27 21:47:30 -0500.]
2007-10-27 21:47:42.606 ApplicationName[2087] *** -[NSXMLDocument
preferredFilename]: selector not recognized [self = 0x3c9130]
2007-10-27 21:47:42.612 ApplicationName[2087] *** -[NSXMLDocument
preferredFilename]: selector not recognized [self = 0x3c9130]
besides releasing the rootElement and xmlDocument am I doing
anything wrong?
Yes. -[NSFileWrapper initDirectoryWithFileWrappers:] expects a
dictionary that contains NSFileWrapper's, not NSXMLDocument's.
_______________________________________________
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