1.寫文件并設(shè)置encoding
OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding("GBK");
output = new XMLWriter(new FileWriter(new File(filename)), format);
output.write(document);
2.先刪文件再創(chuàng)建
File file = new File("d://xxx.xml");
if(file.exists()){
file.delete();
}
CreatXml temp = new CreatXml();
temp.createXMLFile("d://xxx.xml")
posted on 2008-08-20 23:50
xrzp 閱讀(1227)
評(píng)論(0) 編輯 收藏 所屬分類:
JAVA