• 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: Reading values from XML file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading values from XML file


  • Subject: Re: Reading values from XML file
  • From: Uli Kusterer <email@hidden>
  • Date: Sat, 8 Apr 2006 15:06:05 +0200

Am 02.04.2006 um 23:05 schrieb Lorenzo:
So, is any other faster way to save my objects to my custom file?

Several:

1) Use an NSObject subclass instead of a struct and implement NSArchiver/Unarchiver (NSCoding). Then you can write your data to disk "directly" instead of creating lots of intermediate NSStrings and NSNumbers and stuff.

2) Use an XML parser library (like Xerces or whatever .. you may even find stuff like that in MacOS if you can require system versions that have the NSXML or CFXML stuff) to read in your data from files and directly write them into structs, and write them out as strings of XML snippets that you glue together.

3) Just go old-school and write out the raw structs directly (you can stash them in an NSData or use an NSFileHandle or fwrite directly...). Of course, then you won't get a lot of the future- safety of #1 and #2, because you'll have to take care of nice things like: Byte-order markers and endian conversion, different structure padding conventions depending on CPU, OS and compiler, bacwards and future-compatibility (what happens when you add fields to or remove fields from your struct) etc.

Cheers,
-- M. Uli Kusterer
http://www.zathras.de


_______________________________________________ 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
References: 
 >Reading values from XML file (From: Lorenzo <email@hidden>)

  • Prev by Date: Running an application owned by a different user
  • Next by Date: Looking For Outline View Examples Š
  • Previous by thread: Re: Reading values from XML file
  • Next by thread: Re: Cocoa-dev Digest, Vol 3, Issue 420
  • Index(es):
    • Date
    • Thread