生成xml文件
//文档实例
Document document = DocumentHelper.createDocument();
//根元素
Element element = document.addElement("spring");
//添加注释
//element.addComment("this is spring");
//增加处理指令
//element.addProcessingInstruction("target", "text");
Element spring1Element = element.addElement("spring1");
//增加属性
spring1Element.addAttribute("title", "spring");
spring1Element.addAttribute("publisher", "lbm");
spring1Element.setText("spring 1.0");
//document.addDocType("document", null, "docs of lbm");
try{
XMLWriter output = new XMLWriter(new FileWriter( new File("c:/lbm.xml")));
output.write( document );
output.close();
} catch(IOException e){
System.out.println(e.getMessage());
}
System.out.print("complent");