package org.lee.abin.dom4j;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
public class Dom4jCreate {
public static String CreateXml(){
Document document=DocumentHelper.createDocument();
document.setXMLEncoding("UTF-8");
Element rootElement=document.addElement("abin").addAttribute("version", "1.01");
Element first=rootElement.addElement("header").addAttribute("type", "input");
Element second=first.addElement("one").addText("中国");
return document.asXML();
}
public static void main(String[] args) {
Dom4jCreate dom4jC=new Dom4jCreate();
String result=dom4jC.CreateXml();
System.out.println("result="+result);
}
}