[jdom-interest] XML standard line ending

Rick Beton richard.beton at dsl.pipex.com
Fri Mar 12 01:09:08 PST 2004

Elliotte Rusty Harold wrote:

> At 8:53 PM +0000 3/11/04, Rick Beton wrote:
>> One thing that puzzles me is org.jdom.output.Format.java:128.  Why is 
>> the standard line ending CR NL?  It would be natural to use the 
>> machine default, \
> No, it would not. It is very damaging to have the same program emit 
> different output merely because the platform changes. PrintStream is 
> traditionally problematic for precisely this reason.

That is a matter of opinion not fact; I'm not sure why you consider this 
to be so bad.  The standard Java libraries have taken a different 
position.  In an ideal world, Max PC and Unix line endings would all be 
the same.  We don't have that luxury, alas.

> The specific choice of \r\n was made because this is the network 
> standard line ending convention mandated by HTTP among many other 
> protocols. However, if you want to set something else, you are free to 
> do so.

Yes, it is clearly documented:

My choice would be to make the JDOM default the same as the system 
default, and provide a public static final String with the value "\r\n" 
for documents to be sent by HTTP.

Rick :-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3455 bytes
Desc: S/MIME Cryptographic Signature
Url : http://jdom.org/pipermail/jdom-interest/attachments/20040312/394ff5bc/smime.bin

More information about the jdom-interest mailing list