0
我的XML看起來像這 -JDOM getChilden沒有顯示所有的孩子
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Objects>
<object1>object1Value</object1>
<object2>object1Value</object2>
</Objects>
</root>
要顯示在 「對象」 的所有對象我使用的代碼 -
List collected_objects = rootNode.getChildren("Objects");
ListIterator litr = collected_objects.listIterator();
while (litr.hasNext()) {
Element element = (Element) litr.next();
System.out.println(element.toString());
}
但信息 -
[Element: <Objects/>]
爲什麼它不顯示兩個對象?
什麼是根節點的孩子嗎?只是一個節點? – 2012-11-08 19:32:44