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 <cowan AT mercury.ccil.org>
  • 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 20:15:55 -0400

Bradley S. Huffman scripsit:

> My problem is I'm learning toward the position that if I serialize a XOM or
> JDOM tree to text, I should be able to run it through a XML parser and
> XOMHandler/SAXHandler and get the same XOM or JDOM tree where all attribute
> values and text nodes will be the same character for character as the
> original. It just hits my Okie simplicity as the right thing to do.

I agree 100%, and my rules are the way to achieve that. Except that I
botched one of them. Let's try again:

1) Output a \t or \n in an attribute value as a character reference.
2) Output an \n in character content using the current newline separator.
3) Output an \r anywhere as a character reference.
4) Output a space as an encoded space, unless the line needs to be
broken, in which case output it as the current line separator.
5) Output an encodable character as the encoded character.
6) Output a non-encodable character as a character reference.

This reflects the facts that a physical \r or \r\n is reduced to an \n
by the parser always, and a \t or an \n in an attribute value is changed
to a space.


--
Schlingt dreifach einen Kreis vom dies! John Cowan
<jcowan AT reutershealth.com>
Schliesst euer Aug vor heiliger Schau, http://www.reutershealth.com
Denn er genoss vom Honig-Tau, http://www.ccil.org/~cowan
Und trank die Milch vom Paradies. -- Coleridge (tr. Politzer)




Archive powered by MHonArc 2.6.24.

Top of Page