[jdom-interest] Hard-Coded Newlines

Lincoln.J.Carlton at WellsFargo.COM Lincoln.J.Carlton at WellsFargo.COM
Wed Feb 21 15:20:13 PST 2001


I am creating a string of XML from a Document using the XMLOutputter class.
I have set newlines false, yet see two newlines in my output string, one
after the declaration and one at the end of the xml-string.

After reviewing the source for XMLOutputter, I found the following
comment/code in the printDeclaration method:

// Print new line after decl always, even if no other new lines
// Helps the output look better and is semantically
// inconsequential

Though I agree with the comment on semantics, how the output "looks" is
subjective.  If I set newlines to false, the output should be newline-free,

The second newline is from the output(Document,Writer) method.

I have worked-around this issue by setting the lineseparator empty, but am
curious why the extra newlines?



More information about the jdom-interest mailing list