jdom解决中文乱码问题 JAVA生成xml文件
package com.sinosoft.jbs.sevices.sinolifelast.test;import java.io.FileOutputStream;import java.io.IOException;import java.io.OutputStreamWriter;import org.jdom.Attribute;import org.jdom.Document;import org.jdom.Element;import org.jdom.output.XMLOutputter;public class CreateXML {public void create(){Element root=new Element("PEOPLE");Document doc=new Document(root);Element person=new Element("PERSON");root.addContent(person);Attribute attribute=new Attribute("title","这是一个测试的文字");person.addAttribute(attribute);XMLOutputter output=new XMLOutputter();try {//FileWriter writer=new FileWriter("src/people.xml");OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream("d:/people.xml"), "UTF-8");output.output(doc, writer);writer.close();} catch (IOException e) {e.printStackTrace();}}public static void main(String[] args) {new CreateXML().create();}}?转载之(http://blog.csdn.net/zhq426/article/details/7207496)