How to use NSDocument to load and display an XML file?
How to use NSDocument to load and display an XML file?
- Subject: How to use NSDocument to load and display an XML file?
- From: "Chancellor, Robert" <email@hidden>
- Date: Thu, 18 Aug 2005 15:11:22 -0700
- Thread-topic: How to use NSDocument to load and display an XML file?
I have been a Macintosh developer for years but am new to Cocoa. I am
attempting to put together a very simply application, and find that I am
having trouble understanding the steps necessary to achieve my goal.
What I am attempting to do is to crate a simply application that will
read in an XML file and display the contents of the XML file in a single
window.
I have read through documentation on the document-based architecture,
looked at the sample application Sketch and spend hours on the net doing
searches for a solution. I have done the following so far....
[1] Start a new project using the "Cocoa-Document-based Application"
project template.
[2] Switch to IB and put an NSTextView control in the default window.
[3] Add the xml document type to the target properties so the open file
dialog will allow xml files to be selected.
I am unclear on how to proceed next. What connections must I make
between the NSTextView control and other objects so that the data, once
loaded by the NSDocument instance will be displayed in the window?
I am aware that I should be also providing an implementation of
daraRepresentationOfType and loadDataRepresentation, but am unclear as
to what code is expected in these implementations? Should I call the new
NSXml class directly from these methods to load the XML data? I was
under the assumption that NSDocument handled the loading of the data
itself given the proper support?
If anyone can elaborate on the connections necessary in IB to make this
happen, and clarify for me what code I should be putting into
daraRepresentationOfType and loadDataRepresentation to make this all
happen, I would greatly appreciate it. I am hoping that once I
understand what is expected, that everything will click into place and I
will be on my way to better understanding how all this is supposed to
work. Right now, I am having difficulty seeing the big picture.
Thanks in advance.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden