Topic: JDOM写xml时自动填加空行的问题...

  Print this page

1.JDOM写xml时自动填加空行的问题... Copy to clipboard
Posted by: Breeze
Posted on: 2003-12-11 15:36

每次写xml文件时,自动填加一个空行,大家遇到这样的问题没?

fr = new FileReader(path);
SAXBuilder sb = new SAXBuilder();
Document doc = sb.build(fr);

List persons =Test..getChildren(); //得到根元素所有子元素的集合
persons.add(..)//增加一个人

XMLOutputter outp = new XMLOutputter(indent, true, "GBK");
fw = new FileWriter(path);
outp.output(doc, fw);

写入xml,前面的所有人的描述也自动换行,就是增加一个空行.

请大家帮忙...,谢谢!

2.Re:JDOM写xml时自动填加空行的问题... [Re: Breeze] Copy to clipboard
Posted by: 九佰
Posted on: 2003-12-16 11:13

记得有一个忽略空白的函数,具体的忘了
看一下api doc Smile

3.Re:JDOM写xml时自动填加空行的问题... [Re: Breeze] Copy to clipboard
Posted by: bluepure
Posted on: 2004-01-06 11:34

XMLOutputter outp = new XMLOutputter(indent, false, "GBK");

4.Re:JDOM写xml时自动填加空行的问题... [Re: Breeze] Copy to clipboard
Posted by: master_blue
Posted on: 2004-03-09 15:36

唉,应该是上面那样的,把其中一个方法的参数设置一下,具体的就的直接看API了


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923