Re: How to use NSDocument to load and display an XML file?
Re: How to use NSDocument to load and display an XML file?
- Subject: Re: How to use NSDocument to load and display an XML file?
- From: Cameron Hayne <email@hidden>
- Date: Thu, 18 Aug 2005 18:51:58 -0400
On 18-Aug-05, at 6:11 PM, Chancellor, Robert wrote:
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?
I think you need to buy a book on Cocoa - that will make things a lot
easier.
But here's a few pointers:
The 'loadDataRepresentation' method will get called when the user
opens the document.
One of the args to this method is an NSData object holding the raw
file contents. It is up to you to implement this method (or one of
the other two methods used for loading a file - read the NSDocument
docs) and decipher the data (your XML) and then figure out how you
want to display it in your view - e.g. as an NSString that you would
then pass to your NSTextView.
--
Cameron Hayne
email@hidden
_______________________________________________
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