以文本方式查看主题 - 计算机科学论坛 (http://bbs.xml.org.cn/index.asp) -- 『 XML基础 』 (http://bbs.xml.org.cn/list.asp?boardid=1) ---- 更新后的XML中多了空行,如何去除? (http://bbs.xml.org.cn/dispbbs.asp?boardid=1&rootid=&id=269) |
-- 作者:ggsmile -- 发布时间:12/4/2003 8:26:00 AM -- 更新后的XML中多了空行,如何去除? 我用以下形式从文件读取Dom结构, DocumentBuilderFactoryImpl dbf = new DocumentBuilderFactoryImpl(); dbf.setValidating(false); dbf.setIgnoringComments(false); dbf.setIgnoringElementContentWhitespace(true); dbf.setCoalescing(false); dbf.setExpandEntityReferences(false); DocumentBuilderImpl db = (DocumentBuilderImpl)dbf.newDocumentBuilder(); doc = db.parse(file); 用如下的方式回写文件, FileWriter out = new FileWriter(file); ((XmlDocument)doc).write(out,null); out.close(); 结果每执行一次,文件中每行之间就多了一个空行!怎么回事?向大家请教!多谢了! ![]() ![]() |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
31.250ms |