[jdom-interest] End-of-line sequence.
Rolf
jdom at tuis.net
Mon Nov 14 18:04:55 PST 2011
On 14/11/2011 8:57 PM, Elliotte Rusty Harold wrote:
> 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.
I'm not really confusing input/output, the assumption is the XMLOutput
from JDOM will be input for some parser somewhere.... so, JDOM output is
input for something. Perhaps I should have indicated that what I meant
by 'the spec' is to make JDOM XMLOutput 'by default' look more like what
it does inside the JDOM memory model.
As for the specification, yes, \r\n is compliant with parser input, but,
my point is two-fold:
1. that it is 'guaranteed' to be different to the 'XML infoset' after
parsing
2. 'everyone else' does it as a simple '\n', so why are we 'stuck' on \r\n?
>
> Line separators can be chosen or changed already by supplying an
> appropriately configured Format.
>
This is also my point exactly... so, we set the default to '\n', then
the people who 'need' \r\n can set it easily.
The only issue as I see it is: is there a compelling reason for '\r\n'
that I can't see? What are these 'network protocols' that need \r\n?
Rolf
More information about the jdom-interest
mailing list