Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Serializer and line breaks in attribute values

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Marc Ramsey" <marc AT ranlog.com>
  • To: "John Cowan" <jcowan AT reutershealth.com>, "Elliotte Rusty Harold" <elharo AT metalab.unc.edu>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Serializer and line breaks in attribute values
  • Date: Wed, 19 Nov 2003 11:06:06 -0800


"John Cowan" <jcowan AT reutershealth.com> wrote:
> Elliotte Rusty Harold scripsit:
> > You should note that preserving white space in attributes is *very*
> > tricky. Parsers often remove, trim, and compress white space in
> > attributes before XOM ever sees them.
>
> Parsers MUST change line terminators to spaces in attribute values.
>
> If a parser knows that an attribute has a type other than CDATA (and
> attribute declarations in the internal subset MUST NOT be ignored), then
> the parser MUST further trim all leading and trailing spaces, and
> compress all runs of spaces to a single space, in values of that
attribute.
> This is quite independent of whether the parser validates or not.

In my particular case, one tool in the chain was using an older version of
expat, which parsed, within one specific attribute value, a space followed
by a newline as two spaces, resulting in a spurious mismatch between two
attribute values. As a result, two supposedly identical files, one of which
had been serialized through XOM, produced very different results. The
amusing part was that during the process of tracking down the bug, we tried
several XML difference programs, each showed the two files to be identical,
as they were properly compressing sequences of whitespace in attribute
values to a single space...

Regards,
Marc







Archive powered by MHonArc 2.6.24.

Top of Page