字符串生成xml文件
来源:互联网 发布:什么软件开发最有前途 编辑:程序博客网 时间:2024/06/05 03:37
/**
* 字符串,生成xml文件
* @param str
* @param fileName
* @throws IOException
*/
public void strChangeXML(String str,String fileName ) throws IOException {
SAXReader saxReader = new SAXReader();
Document document;
try {
document = saxReader.read(new ByteArrayInputStream(str.getBytes()));
OutputFormat format = OutputFormat.createPrettyPrint();
/** 指定XML字符集编码 */
format.setEncoding("UTF-8");
/** 将document中的内容写入文件中 */
XMLWriter writer = new XMLWriter(new FileWriter(new File(fileName)),format);
writer.write(document);
writer.close();
} catch (DocumentException e) {
// TODOAuto-generatedcatchblock
logger.error(e.getMessage());
}
}
* 字符串,生成xml文件
* @param str
* @param fileName
* @throws IOException
*/
public void strChangeXML(String str,String fileName ) throws IOException {
SAXReader saxReader = new SAXReader();
Document document;
try {
document = saxReader.read(new ByteArrayInputStream(str.getBytes()));
OutputFormat format = OutputFormat.createPrettyPrint();
/** 指定XML字符集编码 */
format.setEncoding("UTF-8");
/** 将document中的内容写入文件中 */
XMLWriter writer = new XMLWriter(new FileWriter(new File(fileName)),format);
writer.write(document);
writer.close();
} catch (DocumentException e) {
// TODOAuto-generatedcatchblock
logger.error(e.getMessage());
}
}
- 字符串生成xml文件
- 字符串xml生成xml文件
- dom4j-xml字符串生成XML文件
- 生成xml选择直接输出字符串(不生成文件)和生成文件
- 动态生成的字符串输出xml文件并下载
- 解析与生成XML文件或字符串 dom4j工具包
- Java以DOM方式解析生成xml文件或字符串
- dom4j-生成XML字符串
- 递归生成XML字符串
- Java中读取XML文件,生成XML格式的字符串并解析这个字符串
- java生成xml文件
- dom4j生成xml文件
- c# 生成 xml 文件
- PHP 生成 XML文件
- C#生成XML文件
- C#生成XML文件
- TinyXML生成xml文件
- 生成一个xml文件
- FlowChart.NET设置命令类的子类
- ios 获取屏幕的属性和宽度
- 对request,session,application作用域形象理解
- java反射机制
- 自绘实现半透明水晶按钮
- 字符串生成xml文件
- 在hibernate中配置EHcache流程
- jQuery 选择符
- opencv获取二值化图像轮廓
- 初识 JUnit 4.0
- 《沁园春·雪》
- VC6.0调试技巧(转载)
- 几个图像数据集
- android电池(五):电池 充电IC(PM2301)驱动分析篇