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 14:37:55 +0000

On Thu, 27 Mar 2014 12:19:06 +0000
<nu.xom AT> wrote:

> On Thu, 27 Mar 2014 11:30:22 +0000
> <nu.xom AT> wrote:
> > Hello.
> >
> > I'm processing some XML into XHTML, and have a few elements where
> > whitespace must be preserved (in order to essentially be inserted
> > directly into XHTML <pre> elements). I want to use the Serializer to
> > get indenting, but want to be able to avoid damaging the whitespace
> > inside the few elements where it should be preserved.
> >
> > Is there a way to achieve this?
> To answer my own question: Adding an xml:space="preserve" attribute on
> the resulting <pre> element seems to make XOM do the right thing.

Actually, to refute my own answer, this results in XHTML that's not
XHTML 1.0 Strict. Elements can't have the xml:space attribute, but are
required in order to stop the Serializer from mangling the contents...

I'm open to suggestions.


Archive powered by MHonArc 2.6.24.

Top of Page