libimobiledevice / libplist

A library to handle Apple Property List format in binary or XML
https://libimobiledevice.org
GNU Lesser General Public License v2.1
546 stars 305 forks source link

plist_t plist_new_key should export #28

Closed xdeng closed 10 years ago

xdeng commented 10 years ago

plist.c 105 static plist_t plist_new_key(const char *val);

in array use

example

book mark plist

FunkyM commented 10 years ago

Hi, sorry, but your Englisch is very bad so we can hardly understand what you want. It would be good if you either provide a concrete example and especially code or write everything in Chinese. Perhaps an online translator can help. Thanks and appreciate your contribution.

The part you are referring to has a very handy comment above:

//These nodes should not be handled by users
static plist_t plist_new_key(const char *val)
xdeng commented 10 years ago

example

<key>Dataclasses</key>
<array>
        <key>Media</key>
        <string>Keybag</string>
        <key>Ringtone</key>
</array>

就像这个plist 里面用到了 plist_t plist_new_key 这个函数

FunkyM commented 10 years ago

Thank for you explanation. The example you provided shows an invalid plist file. Fortunately, both Apple's implementation and libplist correctly parse and "fix" the bad key nodes. If you convert this example to a binary plist and then back, you'll see that the key nodes are actually turned into string nodes to properly comform to the plist DTD. Thus we don't see a valid reason presented to export plist_new_key() in the public API. If you have a good case we're glad to be proven wrong.

xdeng commented 10 years ago

OMG O,O

I see

thank you

xdeng commented 10 years ago

when i sniff itunes sync ringtone, i found that above example , so that i have to create a key no value of the array as same as what itunes did.