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: Elliotte Rusty Harold <elharo AT ibiblio.org>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Electively preserving whitespace
  • Date: Fri, 28 Mar 2014 14:48:06 -0400

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

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.



On Fri, Mar 28, 2014 at 2:41 PM, <nu.xom AT io7m.com> wrote:

> 'Lo.
>
> On Fri, 28 Mar 2014 14:14:29 -0400
> Elliotte Rusty Harold <elharo AT ibiblio.org> 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!).
>
> M
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>



--
Elliotte Rusty Harold
elharo AT ibiblio.org




Archive powered by MHonArc 2.6.24.

Top of Page