[jdom-interest] \r\n problem

Elliotte Rusty Harold elharo at metalab.unc.edu
Mon Aug 28 11:07:27 PDT 2000


At 11:51 AM -0400 8/28/00, Kem Morehead wrote:
>I have a windows file with a \r\n (of course - ugh!). I am creating an xml
>file on unix which takes the \r\n and correctly reads it as two bytes, makes
>no interpretation of its own (thank you, unix) and sends it off. I am using
>jdom in the j++ ide and, if I simply read the InputStream I see the two
>bytes. However, when I read it using getContent in jdom I only get the \n.
>Any ideas why this is happening?
>

According to section 2.11 of the XML Recommendation, 2nd edition:

To simplify the tasks of applications, an XML processor must 
normalize line breaks in parsed entities to #xA either by translating 
the two-character sequence #xD #xA and any #xD that is not followed 
by #xA to #xA on input before parsing, or by using some other method 
such that the characters passed to the application are the same as if 
it did this translation.


In other words, this is exactly what's supposed to happen. It's 
probably even happening in the parser. I don't think JDOM has any 
special logic to enforce this.

+-----------------------+------------------------+-------------------+
| 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