[jdom-interest] XML standard line ending

Rick Beton richard.beton at dsl.pipex.com
Thu Mar 11 12:53:26 PST 2004


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, i.e. .  The W3C Recommendations (*) specify that some 
combination of CR and NL must be used, but they are usually normalised 
to a single NL.  It makes sense therefore for line 128 to instead read:

    private static final String STANDARD_LINE_SEPARATOR = "\n";

java.io.PrintWriter uses the system property |line.separator to control 
the line endings.  This gives the following option:|
|||
|    private static final String STANDARD_LINE_SEPARATOR = 
System.getProperty("line.separator");

This would make XML documents generated by XMLOutputter into normal text 
files on whatever system they are created on, which would be generally 
useful.

What do folks think?

Rick :-)

(*)
XML1.0: http://www.w3.org/TR/2004/REC-xml-20040204
XML1.1: http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-line-ends
I consulted Format.java rev 1.7
-------------- 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/20040311/f5c9ee4c/smime.bin


More information about the jdom-interest mailing list