• 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: Plist entry
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plist entry


  • Subject: Re: Plist entry
  • From: Axel Luttgens <email@hidden>
  • Date: Sat, 19 Jan 2008 13:55:28 +0100

On 19/01/08 13:09, Michael Ghilissen wrote:

Thanks  Axel.

I wish to add a second entry to the plist (e.g. numberKey 6). All my attempts can only override the existing one (in this case numberKey 5):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd ">
<plist version="1.0">
<dict>
<key>numberKey</key>
<integer>5</integer>
</dict>


 <dict>
      <key>numberKey</key>
      <integer>6</integer>
  </dict>

</plist>


Hmm... this will be problematic.
In fact, a plist needs a root. With the above, you would have two roots (moreover, those roots would be indistinguishable, as they are unnamed and don't belong to an ordered set).


So, assuming you really want dictionaries, each holding a single number, you would at least need something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
<key>Some sub dict</key>
<dict>
<key>numberKey</key>
<integer>5</integer>
</dict>
<key>Another sub dict</key>
<dict>
<key>numberKey</key>
<string>6</string>
</dict>
</dict>
</plist>


Alternatively, you could consider an array for the root (an array being an ordered set):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<array>
<dict>
<key>numberKey</key>
<integer>5</integer>
</dict>
<dict>
<key>numberKey</key>
<integer>6</integer>
</dict>
</array>
</plist>


Perhaps could you a bit more precise about your needs, a plist of cookies?
Do you have entire control over the format of that plist, or do you have to comply with some requirements?


HTH,
Axel


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Plist entry
      • From: Luther Fuller <email@hidden>
    • Re: Plist entry
      • From: Michael Ghilissen <email@hidden>
References: 
 >Plist entry (From: Michael Ghilissen <email@hidden>)
 >Re: Plist entry (From: Axel Luttgens <email@hidden>)
 >Re: Plist entry (From: Michael Ghilissen <email@hidden>)

  • Prev by Date: Re: "a reference to"
  • Next by Date: Re: Plist entry
  • Previous by thread: Re: Plist entry
  • Next by thread: Re: Plist entry
  • Index(es):
    • Date
    • Thread