Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Electively preserving whitespace

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: <nu.xom AT io7m.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Electively preserving whitespace
  • Date: Fri, 28 Mar 2014 18:59:53 +0000

'Lo,

On Fri, 28 Mar 2014 14:48:06 -0400
Elliotte Rusty Harold <elharo AT ibiblio.org> wrote:

> This sounds like a case of, "Doctor it hurts when I hit my head with a
> hammer." :-)

I'm not exactly disputing that, but...

> You explicitly told XOM to adjust the white space, so it adjusted the white
> space. If you don't want XOM to change the white space, then don't set
> options whose whole raison d'etre is to change white space.

... and even with those options enabled, it won't adjust the whitespace
if there's an xml:space="preserve" attribute on the element that it's
serializing. However, that attribute will appear in the output,
violating many a schema! So the Serializer itself is actually capable
of both preserving and not preserving whitespace in the same document
when asked (as I'm sure you know, given that you wrote it), but
unfortunately this (apparently undocumented) feature is exposed in a way
such that the output schema has to allow xml:space attributes.

I'm not going to lose sleep over it, but it is slightly frustrating
that I have to lose pretty printing entirely just because I want to
preserve whitespace in _one_ element. I'm coming from a set of XSLT
stylesheets processed with Saxon (http://saxon.sourceforge.net) which
seemed to do a reasonable job of both indenting elements and not
damaging whitespace inside elements *too* badly. I'm not exactly
enthralled with the prospect of telling users that the new Java
implementation of the package I maintain gives messier (source) output
than the original XSLT implementation...

M





Archive powered by MHonArc 2.6.24.

Top of Page