0
XML:JDOM的GetChildren()返回只有一個元素
<root>
<foz>
....
<row>
<column>PD1</column>
<column>PD2</column>
<column>PD3</column>
</row>
...
</foz>
</root>
JAVA:
FileInputStream fin;
fin = new FileInputStream(zip); //zip is a File Object
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry ze = null;
SAXBuilder builder = new SAXBuilder();
Document document = (Document)builder.build(zin);
Element rootNode = document.getRootElement();
List list = rootNode.getChildren("foz");
for (int i = 0; i < list.size(); i++) {
Element node = (Element) list.get(i);
List li = node.getChildren("row");
for (int j = 0; j < li.size(); j++){
Element nodePda = (Element) li.get(j);
String id = nodePda.getChildTextTrim("column");
...
}
}
...
我不無爲什麼一句 「rootNode.getChildren(」 福斯 「);」只返回列表「li」中的一個元素,返回PD1但不返回PD2和PD3值。有誰能夠幫助我?
提前致謝!
不錯!它正在運行。謝謝rolfl – user2003559