How to parse same name tag in Android XML DOM Parsing

核能气质少年 提交于 2019-11-26 18:01:46

Your getValue() method gets MyResource element, from there, you need to get all Items under MyResource and do getElementValue(). Example code is:

   public Map getValue(Element item, String str) {
        NodeList n = item.getElementsByTagName(str);
        for (int i = 0; i < n.getLength(); i++) {
            System.out.println(getElementValue(n.item(i)));
        }
        //Here store it in list/map and return list/map instead of String
        return list/MapHere;
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!