[jdom-interest] XML file corrupted by XMLOutputer

Ken Rune Helland kenh at csc.no
Tue Mar 20 04:03:10 PST 2001


At 10:12 PM 3/19/2001 +0100, Pierre-Yves Saumont wrote:
>Removing child element from an element using removeContent(Element e) and
>then writing back to the xml file sometimes produces garbage at the end of
>the file for example :
>
><?xml version="1.0" encoding="ISO-8859-1"?>
><messages>
></messages>
>
>85019552720">
>             <date>19/03/2001&amp;nbsp;&amp;nbsp;17:32</date>
>             <texte>message 6</texte>
>       </message>
></messages>
>
>Version is Beta 6, used in a servlet, with J2SDK 1.3 and Tomcat 3.1 under
>Win98
>Any idea about what can be going wrong ?

I'm guessing but it seems the file is not correctly overwritten, and
since the new verion is shorter than the old version there is garbage at 
the end.
Are you closing the file correctly after the write?


KenR





More information about the jdom-interest mailing list