Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Serializer to stop adjusting whitespace - round trip problem

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] Serializer to stop adjusting whitespace - round trip problem
  • Date: Thu, 13 Aug 2009 04:59:30 -0700

On Thu, Aug 13, 2009 at 1:15 AM, Peter Taylor<peter.taylor AT greenhat.com>
wrote:
> I have a problem with XOM 1.2.1 not round-triping attribute values when
> indent/max length is set on the Serializer. Specifically it fails to
> round trip the whitespace.

If you tell the serializer to change the whitespace, don't be
surprised when it changes the whitespace. :-) If you need to preserve
whitespace, just use the default options on the serializer. Be aware
that in attribute values in particular, quite a bit of weirdness
happens in the parser before XOM ever sees it:
http://www.w3.org/TR/REC-xml/#AVNormalize

> I have attached a couple of failing junit cases to illistrate the
> problem.

Attachments are stripped by the list server.


> The Serializer code javadoc suggests that the author knew of the
> limitation.


Yep.

> Is this likely to be fixed / enhanced at some point?

No.

> Is there a known patchset that fixes my problem?

No.

> Is there a recommended work-a-round strategy to this?

Don't indent.

> I require indentation with a pseudo max length so that the resulting
> output may be better viewed and diffed in editors and tools that may not
> have intrinsic understanding of XML, and hence would view it as a text
> file.

If white space is significant to you, you really can't do this. The
problem is you seem to want whitespace to matter in some tools and not
in others. That's a tooling issue, not a document issue.

--
Elliotte Rusty Harold
elharo AT ibiblio.org




Archive powered by MHonArc 2.6.24.

Top of Page