转自:
下文笔者讲述创建Document对象的方法分享,如下所示:
SAXReader reader = new SAXReader(); Document document = reader.read(new File("test.xml"));
String txt = ""; Document document = DocumentHelper.parseText(txt);
Document document = DocumentHelper.createDocument(); Element root = document.addElement("users");// 创建根节点