xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Nils_Kilden-Pedersen AT Countrywide.Com
- To: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] Default line separator
- Date: Mon, 21 Apr 2003 08:08:21 -0700
Shouldn't you be using the \n only, per the XML spec 2.11, XOM being the
XML processor?
xom-interest-bounces AT lists.ibiblio.org wrote on 04/20/2003 08:02:51 AM:
> I've been using \r\n as the default line separator for XOM if nothing
> different is specified. However, yesterday this tripped me up in a
> surprising way.
>
> I read in a document, made some modifications to it, and wrote it
> back out again. Having done this, when I loaded it into BBEdit most
> of the document was stuffed on a single line. Investiagtion revealed
> that the line ends were indeed \n as I expected, which BBEdit can
> normally handle. What was going on?
>
> Here's what I eventually discovered:
>
> 1. The parser changes almost all line ends to \n on input. Thus the
> parsed document object had nothing but \n for line ends.
>
> 2. I did not add any line breaks or adjust the formatting in any way
> while modifying the document (I was just changing the namespaces of
> some elements)
>
> 3. There was a single \r\n after the XML declaration which the
> serializer output by default.
>
> 4. BBEdit only accept the first line separator it finds in a document
> as legal. In this case that was \r\n. The subsequent \n characters
> were not treated as line breaks.
>
> First a question: is this just a BBEdit quirk? Will other text
> editors be happy with line breaks that are different in different
> parts of the document? If so I probably don't have to worry about
> this too much.
>
> On the other hand, if this is a common problem. I might want to
> change *all* the line breaks to the current line separator when
> serializing. Currently this is only done if the serializer is either
> indenting or wrapping or both. Thoughts?
> --
>
> +-----------------------+------------------------+-------------------+
> | Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
> +-----------------------+------------------------+-------------------+
> | Processing XML with Java (Addison-Wesley, 2002) |
> | http://www.cafeconleche.org/books/xmljava |
> | http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA |
> +----------------------------------+---------------------------------+
> | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
> | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
> +----------------------------------+---------------------------------+
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>
-
Re: [XOM-interest] Default line separator,
Nils_Kilden-Pedersen, 04/21/2003
- <Possible follow-up(s)>
- Re: [XOM-interest] Default line separator, Elliotte Rusty Harold, 04/21/2003
Archive powered by MHonArc 2.6.24.