Re: Document-Based App Woes
Re: Document-Based App Woes
- Subject: Re: Document-Based App Woes
- From: "I. Savant" <email@hidden>
- Date: Sun, 7 Jan 2007 15:38:17 -0500
Also, give this page a thorough (re)read:
http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/
Tasks/ImplementingDocApp.html
--
I.S.
On Jan 7, 2007, at 3:25 PM, John Bowers wrote:
Hello gracious souls,
Not sure what I'm doing wrong here. I'm trying to build a document
based cocoa app to edit a simple XML file. To learn how to do this
I'm editing just: <name>Some Name</name> My cocoa app has an
NSTextField input that I want to use to edit the value of the
<name> tag in my XML file. To start I am implementing the -
loadDataRepresentation: ofType: method. I have an IBOutlet to my
NSTextField called nameField. So here is my code so far:
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
{
NSXMLDocument *xmlDoc;
NSError *err = nil;
xmlDoc = [[NSXMLDocument alloc] initWithData:data options:nil
error:&err];
//some error handling that I am skipping for brevity...
NSXMLNode *aNode = [xmlDoc rootElement];
NSXMLNode *cNode = [aNode nextNode];
NSString *myStr = [cNode stringValue];
[nameField setStringValue:myStr];
[nameField setNeedsDisplay:YES];
}
Now, this is not doing what I want. I'm thinking that the GUI is
created after the MyDocument object, because I can create a button
that takes myStr (after storing it) and is able to set the string
value of nameField.
Can someone point me in the right direction here. I can't quite
figure out how all this pieces together yet. I've completed several
tutorials on the subject but they just seem to work by magic and
don't really explain how the data is getting to the interface.
Thanks for any help.
-John
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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