public static void main(String[] arg0) {
Element element;
Document document;
element = new Element("infomation");
document = new Document(element);
for(int i = 0 ; i < 10 ; i++){
Element e1, e2;
e1 = new Element("culName");
e1.setText("第三期培训班");
element.addContent(e1);
e2 = new Element("culType");
e2.setText("其它培训");
element.addContent(e2);
}
Format format = Format.getPrettyFormat();
format.setEncoding("UTF-8");
format.setLineSeparator("/r/n");
XMLOutputter XMLOut = new XMLOutputter(format);
try {
XMLOut.output(document, new FileOutputStream("mms.xml"));
} catch (Exception e) {
e.printStackTrace();
}
}