import org.jdom.CDATA;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
public class T {
public String Test()
{
// 创建根节点 Root;
Element root = new Element("Datas");
// 根节点添加到文档中;
Document Doc = new Document(root);
Format format = Format.getPrettyFormat();
format.setEncoding("GBK");
// format.setEncoding("utf-8");
XMLOutputter XMLOut = new XMLOutputter(new XMLOutputter(format));
Element elements = new Element("Data");
byte[] bs = null;
String temp = new sun.misc.BASE64Encoder().encodeBuffer(bs);
CDATA c = new CDATA(temp);
elements.addContent(new Element("content").addContent(c));
// 给父节点Datas添加Data子节点;
root.addContent(elements);
String strXml = XMLOut.outputString(Doc);
return strXml;
}
}