• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: help with data browser?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help with data browser?


  • Subject: Re: help with data browser?
  • From: Bob Sabiston <email@hidden>
  • Date: Sun, 4 Sep 2005 16:21:51 -0500


On Sep 4, 2005, at 12:42 PM, email@hidden wrote:

-- is the '.xml' file created in Library/Application Support for the BlogDemo app in the tutorial a standard thing? That is, do all
such cocoa applications create a file like this?


-- Is this site the best thing for me to read to be able to construct the table I need?
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/
index.html





CoreData is something like a database manager. It helps you store and access your data, but it doesn't have an API for importing data from arbitrary file formats. If you just want a window for viewing the data that is already in a file, and you don't care about programmatically accessing the list, then CoreData may not help you much.

You don't describe the format of your data file. Suppose fields are
separated by tabs, and records by returns. Then you can capture the
list from a file into a string with [NSString
stringWithContentsOfFile:]. The string can be separated into an array
of records with [NSString componentsSeparatedByString:@"\n"]. Each
record can be separated into an array of fields with the same function.


Probably the easiest way to proceed from here is to create a class
that conforms to the NSTableDataSource category. (There's a chapter
on this in the standard docs.)  This requires a bit of programming,
but once you have your data in an array of arrays, or something
similar, it is simple and straightforward to write the required code.

If you want to do more with this table than to browse the data, so
that storing them in a relational db might be useful, you can create
a suitable data model (as described in the tutorial) and then migrate
your data into the database.  If you do this, then you can feed the
table using bindings, again as described in the tutorial.

As for the .xml file format, this has become a standard way of doing
things recently, since it's one of the storage formats that CoreData
supports. But you can also use SQL format, once you have changed a
few things in the data model delegate. (I think the tutorial
describes this briefly towards the end.)

The url you referred to is a good way of getting to know CoreData,
and may be useful if you decide to go that route. However, it goes
beyond what you need to know if you just want to present CoreData in
a table.

Tim Larkin
Abstract Tools



Thanks! What I have is data already in my program--it is stored in C arrays basically. I don't have a file, though I can output to that if necessary, then read it back in. But what it sounds like is I just need to transfer my C arrays into the suitable Objective C/Cocoa format. I guess I'll go through the Core Data documentation I listed above.

Bob

_______________________________________________
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


  • Prev by Date: Re: Drawing an image as hilighted?
  • Next by Date: OT: Writing a system service
  • Previous by thread: Re: help with data browser?
  • Next by thread: Re: NSScrollView: iPhoto/iTunes border type?
  • Index(es):
    • Date
    • Thread