[jdom-interest] End-of-line sequence.

Elliotte Rusty Harold elharo at ibiblio.org
Mon Nov 14 17:57:41 PST 2011

On Mon, Nov 14, 2011 at 8:29 PM, Rolf <jdom at tuis.net> wrote:
> Hi all.
> JDOM has been merrily using "\r\n" as an end-of-line sequence in the
> XMLOutputer since 'forever'. The XML Spec indicates that all end-of-line
> sequences should be normalized to a single '\n':
> http://www.w3.org/TR/REC-xml/#sec-line-ends The wording is such that XML
> parsers should clear out any extra '\r' characters if there are any, so it
> is not as if the code is completely broken.
> But, I think it makes sense to follow the spec, and avoid having different
> XML compared to other systems.
> I propose changing the line separator to follow the spec, but this has a
> very large impact on anyone who has expectations on JDOM having a particular
> line-terminator, even though they shouldn't...

You're confusing input with output. \r\n is fully compliant with the
XML specification.

Line separators can be chosen or changed already by supplying an
appropriately configured Format.

Elliotte Rusty Harold
elharo at ibiblio.org

More information about the jdom-interest mailing list