Re: Using Custom.plist
Re: Using Custom.plist
- Subject: Re: Using Custom.plist
- From: Bob Savage <email@hidden>
- Date: Thu, 05 Jul 2001 20:38:44 -0700
>
I'm trying to write a custom property list and read it (an array) at
>
runtime but without success. Anyone direction?
If you mean what I think you mean, you don't want a custom plist, you want
to use the XML parsing services. Plist is a specific XML format (actually
they are usually referred to as XML applications), but you want to create
your own XML format. That would give you something like:
<shoppinglist>
<date>July 5, 2001</date>
<shopper>Bob</shopper>
<store>Safeway</store>
<item>
<name>milk</item><quantity>half gallon</quantity>
</item>
<item>
<name>bread</item><quantity>2 loaves</quantity>
</item>
<item>
<name>peanut butter</item><quantity>1 small jar</quantity>
</item>
</shoppinglist>
You can do this with the XML services that are defined in Core Foundation,
but, quite frankly, I would try to fake it if I were you, because plists are
much easier to use under Cocoa (hopefully Apple will eventually wrap the XML
services for Cocoa). Instead you could fake it by using a dictionary instead
of an array:
<plist>
<dictionary>
<key>date</key><value>July 5, 2001</value>
<key>shopper</key><value>Bob</value>
<key>date</key><value>July 5, 2001</value>
<key>item</key><value><dictionary>
<key>name</key><value>milk
<dictionary></value>
</dictionary>
</plist>
(and so on...)
This is not a custom plist, it is a regular old plist, and you can use all
the regular Cocoa features to do this auto-magically.
Best,
Bob Savage