Re: Deserialze to NSDictionary with proper type?
Re: Deserialze to NSDictionary with proper type?
- Subject: Re: Deserialze to NSDictionary with proper type?
- From: Daniel Muller <email@hidden>
- Date: Tue, 22 Mar 2005 00:14:31 -0800 (PST)
Thanks Jean-François!
WOXMLCoder / WOXMLDecoder works fine for me, and maybe it's possible to write a mapping model to
read a plist file (xml format).
Daniel
--- Jean-François Veillette <email@hidden> wrote:
> WebObjects .plist deserializer (ascii and xml format) will not keep
> value type, it will all be string type.
>
> If you insist on using a 'pure' .plist format, look in the archive, PA
> posted about java library that would do what you want.
>
> If you do not care about 'pure' .plist format, you can always use
> WOXMLCoder / WOXMLDecoder to serialize your data and read it back.
> This is what I did, simple, working, and the xml format is not so hard
> to read if the file is not too big.
>
> NSBundle bundle = NSBundle.bundleForName(frameworkName);
> byte[] bDict = bundle.bytesForResourcePath(filenameWithExtension);
> if(bDict == null) {
> log.error(...);
> return null;
> }
> NSDictionary dict =
> (NSDictionary)WOXMLDecoder.decoder().decodeRootObject(new
> NSData(bDict));
>
>
> - jfv
>
> Le 05-03-21, à 04:07, Daniel Muller a écrit :
>
> > Hello,
> >
> > I'm wondering how to de-serialize a plist file (xml
> > format) to a NSDictionary with the proper type for all
> > the simple keys. It seems
> > NSPropertyListSerialization.dictionaryForString or
> > NSPropertyListSerialization.propertyListFromString
> > creates a NSDictionary with a String type for all
> > simple keys instead of Number, Date or Boolean, even
> > if the keys are <integer>, <real>, <date> or
> > <boolean>.
> >
> > Any idea how to get the proper type while
> > de-serializing a property list file in a dictionary?
__________________________________
Do you Yahoo!?
Make Yahoo! your home page
http://www.yahoo.com/r/hs
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden