Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Extra white space escaping to preserve the infoset

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: John Cowan <jcowan AT reutershealth.com>
  • To: "Bradley S. Huffman" <hip AT cs.okstate.edu>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Extra white space escaping to preserve the infoset
  • Date: Tue, 8 Jul 2003 15:43:31 -0400

Bradley S. Huffman scripsit:

> > On the other hand, if the user does set the line separator to a
> > linefeed (for example) then I think I'm justified in changing all
> > line breaks including those in attribute values to line feeds.

I don't think so. Suppose I'm running on a Unix system, where \n is the
line separator and \r is an obscure, usually useless control character. If
I have an \r in character content or attribute value somewhere, it
*almost certainly* means that I read a document, either native or from
some foreign system, that had an explicit &#xD; in it. Whoever wrote that
meant what he said, and it should be properly re-created on output.

> Look at that, 3 paragraphs to try and explain what to do with two
> little characters :-) There's got to be a easier way that we're missing.

I think this covers all cases:

1. Output every \n as the current line separator.
2. Output every \r as a character reference.
3. Output every \t as a character reference in attribute values only.
4. Output every character not represented in the output encoding as
a character reference.
5. Output every space character using the current output encoding,
unless you need to break up a line, in which case output it as the
current line separator.
6. Output every other character using the current output encoding.

--
Dream projects long deferred John Cowan <jcowan AT reutershealth.com>
usually bite the wax tadpole. http://www.ccil.org/~cowan
--James Lileks http://www.reutershealth.com




Archive powered by MHonArc 2.6.24.

Top of Page