摘要: XML文件 book.xml Kiran Pai 22 Bill Gates 46 Steve Jobs 40 程序输出 Root element of the doc is book Total no of people: 3 First Name: Kiran Last Name: Pai Age: 22 First Name: Bill Last Name: Gates Age: 46 First Name: Steve Last Name: Jobs Age: 40 阅读全文
posted @ 2009-11-13 16:34 mogu 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 首先导入dom4j.jar包,这个包里面有我们创建XML文件需要用到的类,比如常用的有: Document: import org.dom4j.Document; Import org.dom4j.DocumentHelper; DocumentHelper.createDocument(); 获得文档对象 addElement方法增加根节点 getRootElement方法获得根节点 asXML方法将文档对象包含的内容转换为字符 addComment方法在增加注释 getPath方法获得路径,根节点为/ 阅读全文
posted @ 2009-11-13 16:31 mogu 阅读(827) 评论(0) 推荐(0) 编辑