我想列出 android 4.0 中标签的所有值,到目前为止我只能得到一个值我添加了我现在正在使用的代码段以及下面的 xml。请帮助这带有 fragment 或示例。非常感谢。
NodeList nodes = doc.getElementsByTagName("month");
for (int i = 0; i < nodes.getLength(); i++) {
Element e = (Element) nodes.item(i);
stock_list.add(getValue(e, "month"));
}
Here is my xml
最佳答案
nodeValue根据定义,XML 元素的 null
。因此,您可以
- 为包含实际内容的
Text
节点查询元素的子元素,或者 - 只需使用
e.getTextContent()
检索 XML 元素的文本内容。
关于android - android 4.0如何获取子节点的所有值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11752931/