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);
}
}
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);
}
}
解决方案 »
- 菜鸟问几个小问题……
- tomcat启动一段时间后自动挂掉。。。
- 并发执行
- 关于application做访问量的问题
- 如何在java中获取Oracle里获取自增ID 在线等 谢谢啦
- 请问CORBA用DSI方式编写服务器如何设置数组和结构类型的参数和返回值
- 请问达人,我的代码连接sqlserver2000 sp3库出错,找了半天不知为啥,望大虾能指点一下
- 求教一个关于hibernate的在联级查询的问题
- 请教: jbuilder8+weblogic7开发JMS的请进?
- 有关XML文件的多页显示的问题
- J2EE应用与BEA WebLogic Server这本书的光盘谁有啊!!
- 如何在TOMCAT5.5.1下显示自己的JSP网页?(不明白的朋友请不要回复)
环境变量设置classpath:.;D:\Xerces\xerces-1_4_4\xerces.jar;D:\Xerces\xerces-1_4_4\xercesSamples.jar;D:\Xerces\xerces-1_4_4\jaxp.jar;D:\Xerces\xerces-1_4_4\parser.jar