How to parse .plist file in Java?

ⅰ亾dé卋堺 提交于 2019-11-29 11:26:44

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());
        }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!