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: "Bradley S. Huffman" <hip AT cs.okstate.edu>
  • To: John Cowan <cowan AT mercury.ccil.org>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Extra white space escaping to preserve the infoset
  • Date: Tue, 08 Jul 2003 19:55:50 -0500

John Cowan writes:

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

Yes, this sounds better :-)

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

I like it, but Elliotte's the boss :-) Mind if I take these rules over to
the JDOM realm sometime for possible inclusion in it's XMLOutputter?

Brad




Archive powered by MHonArc 2.6.24.

Top of Page