java dom4j生成xml字符串是怎么设置编码
展开全部
/** 将document中的内容写入文件中 */
OutputFormat outputFormat = new OutputFormat();
outputFormat.setEncoding("UTF-8");
XMLWriter writer = new XMLWriter(new FileWriter(new File(filename)),outputFormat);
writer.write(document);
writer.close();
/** 执行成功,需返回1 */
returnValue = 1;
OutputFormat outputFormat = new OutputFormat();
outputFormat.setEncoding("UTF-8");
XMLWriter writer = new XMLWriter(new FileWriter(new File(filename)),outputFormat);
writer.write(document);
writer.close();
/** 执行成功,需返回1 */
returnValue = 1;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询