如何从Android中的XML阅读同名子标签 [英] How to Read same name child tag from xml in android

查看:127
本文介绍了如何从Android中的XML阅读同名子标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我是android系统中新
我想知道如何从XML迭代子节点
XML是如下

hello i am new in android i want know how to iterate child node from xml xml is as follow

    <?xml version="1.0" encoding="utf-8"?> <ACT>                
    <Item>ABC</Item>
    <Item>XYZ</Item> </ACT>

我想借此项值从ACT标签

i want to take Item VAlue From ACT tag

推荐答案

看看这个答案

更新:的code贴只列出的第一个项目,因为环比 nodes3 的onCreate 循环只有在 ACT 元素。因为你只有其中之一,循环将遍历一次,写出来的第一个孩子,然后终止。你必须有你的循环内的第二循环,你遍历元素的所有子节点电子

Update: the code posted will only list the first Item because the loop over nodes3 in onCreate loops only over the ACT elements. Since you have only one of these, the loop will iterate once, write out the first child and then terminate. You must have a second loop inside your loop where you iterate over all child nodes of element e.

这篇关于如何从Android中的XML阅读同名子标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆