xml结点的遍历

dom4j通过ElementIterator对xml节点进行遍历
xml文件
<students>
<student>

<name>a</name>
<age>19</age>
<course>math</cource>
<course>english</cource>

</student>
</students>

这里先获取student节点。

Element stu;

然后获取这个节点的子节点course的iterator对象
Iterator it=stu.elementIterator("course");
while(itr.hasNext()){
			Element node=(Element) itr.next();
                        System.out.println(node.getName());
			System.out.println(node.getText());
			
		}
 

这里便会输出:
course
math
course
english

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念