Re: Reading values from XML file
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