• 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
Hierarchal Archiving
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hierarchal Archiving


  • Subject: Hierarchal Archiving
  • From: The Amazing Llama <email@hidden>
  • Date: Tue, 28 Jan 2003 10:21:38 -0800

I am programming a document that needs to save it's data to disk, like any good document.

The data in question is a dictionary whose keys are names (NSStrings) and whose objects are a custom class I have coded, whose instances store arrays of arrays of numbers. How do I write this to disk? The options I know of are:

use NSArchiver.
This has lots of drawbacks for future file formats, as well as ordering issues. I'd rather avoid it.

use NSKeyedArchiver.
This is better than the above, but I can't figure out how to archive the array in a clean, object-oriented way; I cannot have each of my objects store using simple keys, because they all try to store using the same keys. I would have to subclass NSKeyedArchiver to provide some sort of context for each object, or have each of my custom instances make it's own NSKeyedArchiver, store it's data in that, and then encode the resulting NSData instead of itself. This would be a hassle and not clean at all, in my opinion.

use NSDictionary's writeToFile:atomically:
This would be my favorite option, as it writes to clean, readable xml that doesn't use unique IDs to identify its own parts, but I can't figure out how to go about it. writeToFile:atomically will only store certain types, and appears to have no extensibility in this regard.

Look at ~/Library/Safari/Bookmarks.plist to see what I'd like to be able to do; a simple array of objects, within which I can store the same keys over and over, without colliding into each other. Is there any good way of doing this?

Seth A. Roby The Amazing Llama < mail or AIM me at tallama at mac dot com>
"Life is like an exploded clown. It's really funny until you figure out what just happened."
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Hierarchal Archiving
      • From: Don Murta <email@hidden>
    • Re: Hierarchal Archiving
      • From: j o a r <email@hidden>
  • Prev by Date: Re: Drawing gradients in views
  • Next by Date: Re: Drawing gradients in views
  • Previous by thread: PeopleSoft Development Possibility
  • Next by thread: Re: Hierarchal Archiving
  • Index(es):
    • Date
    • Thread