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 14:13:44 -0400

Bradley S. Huffman scripsit:

> Here's my scenerio, I have a attribute with value "one\ntwo" and I set the
> line seperator to "\r\n", after I serialize and re-parse, what's the value
> of that attribute?

I think that when \n, \r, and \t occur in attribute values they should always
be represented with character references; the same applies to \r in
character content. This is the only way to round-trip, and should be
absolutely independent of the value of the line separator. About the
only way to get an \r in either an attribute value or character content
is to use a char ref anyway; there are Stupid Parameter Entity Tricks
that can also achieve it, but they aren't worth knowing about.

> XOM converts "\n" to "\r\n" on serialization, then the parser normalizes
> this
> to two spaces since it's in a attribute value and not from a external
> parsed
> entity (which would have normalized it to a single &#A;, right? Oh what a
> mess).

No. When the parser re-reads such a document, it immediately normalizes
the \r\n to a single \n. Attribute-value normalization then maps this to
a single space.

--
But that, he realized, was a foolish John Cowan
thought; as no one knew better than he jcowan AT reutershealth.com
that the Wall had no other side. http://www.ccil.org/~cowan
--Arthur C. Clarke, "The Wall of Darkness"




Archive powered by MHonArc 2.6.24.

Top of Page