Cannot parse a plist containing a key with an empty string
Created by: timsutton
My first attempt with this pkg was trying to parse Apple's Software Update feed at https://swscan.apple.com/content/catalogs/others/index-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.
It's a dictionary plist, containing a dict called Products
, and all of its items are dictionaries keyed by an identifier. There are several hundred entries in this list, and one of them (041-4728
) contains a key that is empty, ie. <key></key>
You can see it by grepping:
curl https://swscan.apple.com/content/catalogs/others/index-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog | grep -C 20 \<key\>\<\/key\>
Trying to parse this plist I get a 0
returned for the format and the error: plist: error parsing XML property list: missing key in dictionary
:
https://github.com/DHowett/go-plist/blob/c61954340689b1debd57cad98f0b5efe8cf75d4a/xml.go#L268-L270
Having dealt heavily with plists as a sysadmin for years, this if the first "empty key" I've ever encountered. I've been able to use Python's plistlib and Objective-C's Foundation libs to parse this same plist (even though I can't actually "get to" the data in this key). While I realize it's inane to have an empty key in a plist, is there a way that go-plist could handle this bizarre situation?