[b]如题:我使用java jdom创建xml,像以这样的xml格式输出:<?xml version="1.0" encoding="utf-8"?><a>aa</a>[/,但是实际输出却是这样的,]:
<?xml version="1.0" encoding="utf-8"?>
<a>aa</a>,xml body和头部不在同一行,望高人指点。b]Format format = Format.getCompactFormat();
// 设置文档字符编码
format.setEncoding("UTF-8");
// 设置缩进字符串
format.setIndent(null);
XMLOut = new XMLOutputter(format);
byteRep = new ByteArrayOutputStream();
XMLOut.output(doc, byteRep);
String result = new String(byteRep.toByteArray(), "UTF-8");xmljavaencodingstring文档
<?xml version="1.0" encoding="utf-8"?>
<a>aa</a>,xml body和头部不在同一行,望高人指点。b]Format format = Format.getCompactFormat();
// 设置文档字符编码
format.setEncoding("UTF-8");
// 设置缩进字符串
format.setIndent(null);
XMLOut = new XMLOutputter(format);
byteRep = new ByteArrayOutputStream();
XMLOut.output(doc, byteRep);
String result = new String(byteRep.toByteArray(), "UTF-8");xmljavaencodingstring文档
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货