[jdom-interest] bug: JDOM 1.0 XMLOutputter.outputString() -- trailing 0A character

William Krick wkrick at eio-online.com
Tue Nov 29 14:00:59 PST 2005

It puts a 0D0A (CRLF) at the end of each line and an additional 0D0A (CRLF)
at the end of the file, as you mention.  But then there is a final 0A
character tacked on the end.

Here's a link to our servlet that generates the XML using JDOM...


Open the link in your browser, save the file to your desktop, then open it
in an editor that allows you to look at the file in hex mode.  You'll see
the extra 0A at the end of the file.

-----Original Message-----
From: Jason Hunter [mailto:jhunter at xquery.com]
Sent: Tuesday, November 29, 2005 4:41 PM
To: William Krick
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] bug: JDOM 1.0 XMLOutputter.outputString()
-- trailing 0A character

The pretty formatter prints a newline at the end of output.  When
printed to a console or file this is "prettier".  :)


William Krick wrote:

> I have a jdom document object built dynamically by my application.
> When I use XMLOutputter.outputString() to convert the document to a
> the resulting string ends with an extra trailing 0A character.  This
> to be a bug.
> Here's what the code looks like...
> XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
> String s = outputter.outputString(doc);
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.13.10/188 - Release Date:
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com

More information about the jdom-interest mailing list