private void save()throws Exception{
XMLOutputter printDoc = new XMLOutputter(" ",true); //缩近
printDoc.setTextNormalize(true);
printDoc.setExpandEmptyElements(false);
printDoc.setTextTrim(true);
printDoc.setTrimAllWhite(true);
printDoc.setEncoding("ISO-8859-1");
printDoc.output(doc, new FileOutputStream(fileURI));
}
XMLOutputter printDoc = new XMLOutputter(" ",true); //缩近
printDoc.setTextNormalize(true);
printDoc.setExpandEmptyElements(false);
printDoc.setTextTrim(true);
printDoc.setTrimAllWhite(true);
printDoc.setEncoding("ISO-8859-1");
printDoc.output(doc, new FileOutputStream(fileURI));
}
boolean newLines = false;
XMLOutputter output = new XMLOutputter(indent,newLines,"GBK");
您用的JDOM版本是多少的,我的JDOM没有
printDoc.setTextNormalize(true);
printDoc.setTextTrim(true);
printDoc.setTrimAllWhite(true);
这三个方法.我的JDOM是 Jb7带的jdom.
我的jdom版本有setTrimText(boolean)方法,只有社为true就解决了,谢谢!
快去www.jdom.org 下在新版