[jdom-interest] end-of-line character
Elliotte Rusty Harold
elharo at metalab.unc.edu
Thu Jul 6 05:48:56 PDT 2000
At 1:58 PM -0700 7/5/00, Kevin Regan wrote:
>All XML-aware applications that use an XML processor will
>only ever see '\n', correct? In this case, it does not seem
>to matter how the document is output. In this event, I guess
>the question should be whether it is more important to output
>the document in a standard way or output it in a way that would
>be useful for viewing by standard text editors/viewers on the
>system that the document is created on.
>
It's not just XML parsers we have to worry about here. Many other
tools ranging from simple text editors like emacs to Unix utils like
cat to GUI FTP programs to custom Java software all have to be able
to read and write XML files without knowing squat about XML. \r\n is
the standard line terminator used in more network protocols than
anything else. Most network software that implements protocols that
require \r\n (HTTP for example) is fairly forgiving of non-standard
requests that use \n instead of \r\n but there's always something out
there that isn't and actually expects authors to adhere to the spec.
Furthermore, it is not acceptable for JDOM output to be platform
dependent. A simple program that creates a document in memory with no
user input or random characteristics and serializes it should produce
byte-for-byte identical output on Windows, the Mac, and Unix. It
should not change from platform to platform. This is important for
digital signatures, among other use cases.
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible (IDG Books, 1999) |
| http://metalab.unc.edu/xml/books/bible/ |
| http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://metalab.unc.edu/javafaq/ |
| Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list