go-plist icon indicating copy to clipboard operation
go-plist copied to clipboard

Implement sparse/keyed array support

Open q3k opened this issue 2 years ago • 2 comments

The following is a valid plist XML:

<array>
    <key>100</key>
    <string>foo</string>
    <key>200</key>
    <string>bar</string>
</array>

This enables parsing such arrays to dictionaries, which can in turn be unmarshaled to Go maps, similarly to elements.

This isn't great, as ideally keys should be integers, and order should be preserved - but at least it allows for some kind of parse.

q3k avatar Feb 25 '23 21:02 q3k

Hey, thanks for the contribution! Do you have any information on when this became supported in NSPropertyListSerialization? Do you know if a construction like this is supported in any of the non-XML formats?

DHowett avatar Feb 25 '23 21:02 DHowett

Nope. I just got a plist in this shape from an iPod that I'm hacking on: https://object.ceph-eu.hswaw.net/q3k-personal/079c8917f97c55a76937cb7f5dc6d37b4f71f2e1775011af5c4bbffbf05f191b.xml

All I know is that plutil -lint says it's indeed okay. This totally is not my area of expertise. :)

q3k avatar Feb 25 '23 22:02 q3k