XMLConfiguration 笔记

<?xml version="1.0" encoding="utf-8" ?>

<class>
<student id="1">
<name>黄友敏</name>
<sex></sex>
<age>22</age>
<subject>
<name>数学</name>
<score>98.5</score>
<name>语文</name>
<score>100</score>
</subject>
<parent>黄,刘</parent>
</student>
</class>

 XMLConfiguration config = new XMLConfiguration("student.xml")

取节点:

config.getString("student.name"):黄友敏

取节点属性:

config.getString("student[@id]") :1

取list:返回的list中的对象为String类型

config.getList("student.subject.score")

posted @ 2012-01-14 14:11  刘振明  阅读(349)  评论(0编辑  收藏  举报