How to get the values from plist in Android?

烂漫一生 提交于 2019-12-12 03:33:32

问题


Currently i am working in Android application, Using plist to store some values in Resource folder, then i get the local plist value from Resource in Android, but i cannot get these, How to parse local plist value in Android? please help me

Thanks

Here i mentioned Plist value here

<?xml version="1.0" encoding="UTF-8"?>
<array>
    <dict>
        <key>Code</key>
        <string>11</string>
        <key>Country</key>
        <string>Afghanistan</string>
    </dict>
    <dict>
        <key>Code</key>
        <string>12213</string>
        <key>Country</key>
        <string>Aland Islands</string>
    </dict>
    <dict>
        <key>Code</key>
        <string>24144</string>
        <key>Country</key>
        <string>Albania</string>
    </dict>
    <dict>
        <key>Code</key>
        <string>35223434</string>
        <key>Country</key>
        <string>Algeria</string>
    </dict>
</array>

回答1:


Check this: Android PList Parser

Example usage from the tests-

PListXMLParser parser = new PListXMLParser();
PListXMLHandler handler = new PListXMLHandler();
parser.setHandler(handler);
parser.parse(plistContentAsString);
PList plist = ((PListXMLHandler)parser.getHandler()).getPlist();
// use the plist
plist.getRootElement(); // get root element


来源:https://stackoverflow.com/questions/11632320/how-to-get-the-values-from-plist-in-android

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