I am trying to parse a .plist
file in Java but not understanding how. I used a DOM parser but it gives an error and is not able to read .plist
file
If I were you I'd use the PList class from code.google.com/xmlwise. It's specifically designed for dealing with .plist files.
You will want to look at Apache Commons Configuration at http://commons.apache.org/proper/commons-configuration/, which offers a pList parser. Here's a snippet example:
XMLPropertyListConfiguration plist = new XMLPropertyListConfiguration();
// load plist from classoath
URL url = this.getClass().getClassLoader().getResource(systemConfigFile);
plist.setFileName(url.getFile());
plist.load();
Iterator<String> keys = plist.getKeys();
while (keys.hasNext()) {
// do someting with the value
plist.getString(keys.next());
}