各位大虾帮帮忙。我使用jdom操作xml发现产生了很多的空行,导致xml文件很大,请问该如何解决???
操作xml源代码
FileInputStream fi = new FileInputStream(path);
SAXBuilder sb = new SAXBuilder();
Document doc = sb.build(fi);
Element rootElement = doc.getRootElement();
Element Products = rootElement.getChild(product_id);//活动节点
Products.setAttribute("linkUrl",urlStr);//url
XMLOutputter outputter = new XMLOutputter("",true,"gb2312"); //格式化输出,产生缩进和换行
FileOutputStream out = new FileOutputStream(path);
outputter.output(doc, out);
out.close();
操作xml源代码
FileInputStream fi = new FileInputStream(path);
SAXBuilder sb = new SAXBuilder();
Document doc = sb.build(fi);
Element rootElement = doc.getRootElement();
Element Products = rootElement.getChild(product_id);//活动节点
Products.setAttribute("linkUrl",urlStr);//url
XMLOutputter outputter = new XMLOutputter("",true,"gb2312"); //格式化输出,产生缩进和换行
FileOutputStream out = new FileOutputStream(path);
outputter.output(doc, out);
out.close();
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货