Discussion:
[XOM-interest] [SPAM(hdr)] - Using Serializer with Indenting (without alteringAttribute values)
Peter Taylor
2011-09-15 16:25:16 UTC
Permalink
Certiainly there never use to be. I ended up transforming the XOM to
DOM.

Then it's easy to indent and you'd expect:

http://www.chipkillmar.net/2009/03/25/pretty-print-xml-from-a-dom/

-----Original Message-----
From: xom-interest-bounces at lists.ibiblio.org
[mailto:xom-interest-bounces at lists.ibiblio.org] On Behalf Of Jens Kripl
Sent: 15 August 2011 20:57
To: xom-interest at lists.ibiblio.org
Subject: [SPAM(hdr)] - [XOM-interest] Using Serializer with Indenting
(without alteringAttribute values)

Hi,

I'm using the Serializer to pretty print my XOM constructed XML.
I've read the javadoc and some comments on the list that it may change
whitespace, but this is really a problem for me:

Before : <foo name="Abc CdeF" />
After : <foo name="Abc CdeF" />
Expected: <foo name="Abc CdeF" />

Is there any way to change this behaviour? The value of the attribute
should not be changed, but elements should be indented.


Regards,
Jens
Elliotte Rusty Harold
2011-09-15 22:40:42 UTC
Permalink
On Thu, Sep 15, 2011 at 12:25 PM, Peter Taylor
Post by Peter Taylor
Certiainly there never use to be. I ended up transforming the XOM to
DOM.
http://www.chipkillmar.net/2009/03/25/pretty-print-xml-from-a-dom/
-----Original Message-----
From: xom-interest-bounces at lists.ibiblio.org
[mailto:xom-interest-bounces at lists.ibiblio.org] On Behalf Of Jens Kripl
Sent: 15 August 2011 20:57
To: xom-interest at lists.ibiblio.org
Subject: [SPAM(hdr)] - [XOM-interest] Using Serializer with Indenting
(without alteringAttribute values)
Hi,
I'm using the Serializer to pretty print my XOM constructed XML.
I've read the javadoc and some comments on the list that it may change
Before : <foo name="Abc CdeF" />
After : <foo name="Abc CdeF" />
Expected: <foo name="Abc CdeF" />
Is there any way to change this behaviour? The value of the attribute
should not be changed, but elements should be indented.
there are several things that could be happening here. Do you have a test case?

However if you tell XOM to change the white space by indenting, then
yes, it will change the white space. If you don't want XOM to change
the white space, don't use indenting.
--
Elliotte Rusty Harold
elharo at ibiblio.org
Leif Stainsby
2011-09-15 22:57:48 UTC
Permalink
Elliotte,

Assuming the attribute in question is declared as CDATA (most likely
case...), wouldn't it be incorrect for the formatter (while performing
the indenting) to modify the attribute content?

...Leif
Post by Peter Taylor
-----Original Message-----
From: xom-interest-bounces at lists.ibiblio.org
[mailto:xom-interest-bounces at lists.ibiblio.org] On Behalf Of
Elliotte Rusty Harold
Sent: Thursday, September 15, 2011 3:41 PM
To: XOM API for Processing XML with Java
Subject: Re: [XOM-interest] [SPAM(hdr)] - Using Serializer
with Indenting (without alteringAttribute values)
On Thu, Sep 15, 2011 at 12:25 PM, Peter Taylor
Post by Peter Taylor
Certiainly there never use to be. I ended up transforming
the XOM to
Post by Peter Taylor
DOM.
http://www.chipkillmar.net/2009/03/25/pretty-print-xml-from-a-dom/
-----Original Message-----
From: xom-interest-bounces at lists.ibiblio.org
[mailto:xom-interest-bounces at lists.ibiblio.org] On Behalf Of Jens Kripl
Sent: 15 August 2011 20:57
To: xom-interest at lists.ibiblio.org
Subject: [SPAM(hdr)] - [XOM-interest] Using Serializer with
Indenting
Post by Peter Taylor
(without alteringAttribute values)
Hi,
I'm using the Serializer to pretty print my XOM constructed XML.
I've read the javadoc and some comments on the list that it
may change
Post by Peter Taylor
Before : <foo name="Abc CdeF" />
After : <foo name="Abc CdeF" />
Expected: <foo name="Abc CdeF" />
Is there any way to change this behaviour? The value of the
attribute
Post by Peter Taylor
should not be changed, but elements should be indented.
there are several things that could be happening here. Do you
have a test case?
However if you tell XOM to change the white space by
indenting, then yes, it will change the white space. If you
don't want XOM to change the white space, don't use indenting.
--
Elliotte Rusty Harold
elharo at ibiblio.org
_______________________________________________
XOM-interest mailing list
XOM-interest at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest
Elliotte Rusty Harold
2011-09-15 23:40:11 UTC
Permalink
Post by Leif Stainsby
Elliotte,
Assuming the attribute in question is declared as CDATA (most likely
case...), wouldn't it be incorrect for the formatter (while performing
the indenting) to modify the attribute content?
No, it is not incorrect. Indenting is a specific request to change the
white space. If you don't want to change the white space, don't tell
the serializer to indent. The default behavior is not to indent.
--
Elliotte Rusty Harold
elharo at ibiblio.org
Loading...