package com.apparatus.sample;import org.jdom.*;
import org.jdom.output.*;
import java.io.*;public class formXML {

public static void main(String[] args)throws IOException {
Document doc=new Document();
Element root=new Element("MT");
doc.setRootElement(root);

Element billing=new Element("billing");
root.addContent(billing);
billing.addContent(new Element("cp_coded").setText("hs"));
billing.addContent(new Element("dest_number").setText("1380000000"));
billing.addContent(new Element("src_number").setText("1389093998"));
billing.addContent(new Element("service_code").setText("DT"));
billing.addContent(new Element("plan").setAttribute("id","plan_id"));
root.addContent(new Element("content").setText("content is here."));

XMLOutputter outp=new XMLOutputter();

Format format=Format.getPrettyFormat();
format.setEncoding("GBK");
outp.setFormat(format);
outp.output(doc,System.out);

}
}