使用DOM4J生成XML文档
package xml; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.List; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; /** * @author xingsir * 使用DOM4J生成XML文档 */ public class WriteXmlDemo { public static void main(String[] args) { List<Dept> deptlist=new ArrayList<>(); deptlist.add(new Dept(1,"综合部","2020-01-01",400,"孙悟空")); deptlist.add(new Dept(2,"人事部","2020-01-01",400,"朱悟能")); deptlist.add(new Dept(3,"研发部","2020-01-01",400,"白龙马")); deptlist.add(new Dept(4,"销售部",