javaobjective-cplistxml-parsing

Apple Plist Converted to Java Data Structures


I have a program that is going to be receiving info displayed in it from a .plist on my server. However, I am going to be making this for PC, and I'm using Java to do so. Plist files aren't conventional XML, so common XML parsing libraries don't work. I can't locate any plist specific parsers, so I am lost on how to continue. The way I see it my options are:

a) Locate such a parser for the plist file

b) Make a workaround using a regular XML parser

c) Change the file the program gets its data from (undesirable)

Has anyone else had any experience with plists in languages other than Objective-C?


Solution

  • As @Jochen Bedersdorfer notes, .plist files are XML with a well-formed DTD. Use plutil to convert them from binary to text form.

    <?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">
    

    Addendum: In a comment, you asked

    Isn't it text form when I get it?

    Not necessarily. Here's some history on the subject.