Skip to Content.
Sympa Menu

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

xom-interest AT

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: <nu.xom AT>
  • To: xom-interest AT
  • Subject: Re: [XOM-interest] Electively preserving whitespace
  • Date: Fri, 28 Mar 2014 18:41:15 +0000


On Fri, 28 Mar 2014 14:14:29 -0400
Elliotte Rusty Harold <elharo AT> wrote:

> Do you have a minimal example that demonstrates your issue? The default
> setting should preserve all significant white space including ignorable
> white space and boundary white space. If you told the serializer to adjust
> white space, e.g. by setting a max line length; all bets are off.

The basic issue is that with indenting and/or max line lengths enabled,
the only way to get the Serializer to preserve whitespace is by adding
an xml:space="preserve" attribute to the elements that require it. This
would be fine except that, in my case, the serialized output is intended
to be validated as XHTML Strict 1.0, and elements in that schema are not
allowed to have that attribute. The serializer with pretty printing
disabled does indeed preserve all whitespace, as you've said.

I could disable pretty printing, but I'd really prefer not to. I've
just finished translating a set of XSLT stylesheets to java and have
stumbled upon this issue right at the end of the development.

I can work around this issue locally by patching xom, by adding a flag
to the Serializer that causes it to omit xml:space attributes from the
output, but this isn't exactly a pleasant hack (and I somewhat doubt
it'd be accepted into the main codebase!).


Archive powered by MHonArc 2.6.24.

Top of Page