commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <si...@ecnetwork.co.nz>
Subject Re: Digester trimming whitespaces
Date Sun, 03 Oct 2004 21:12:36 GMT
On Fri, 2004-10-01 at 20:40, Marco Mistroni wrote:
> Hello all,
> 	I am currently having a problem (?) with digester in the
> Sense that in parsing XML is 'trimming' whitespaces..

Hi Marco,

Yes, some Digester rules do this deliberately. If you look at the source
for CallParamRule, CallMethodRule, etc. you will see something like:
  bodyText = bodyText.trim();

As this code precedes my involvement in Digester, I can't say exactly
what the motivation was for doing this, but presume there was a good
reason. I certainly have been using digester fairly heavily and not
needed to allow leading/trailing whitespace in element bodies. However I
can understand that some people might need to.

I would recommend that you take a copy of the source of whatever rule is
causing you problems and rename the class (including changing the
package declaration to something in your namespace), then delete the
trim() call.

If you feel like contributing a patch to add some kind of boolean flag
to the original Rule class to allow people to enable/disable trimming of
whitespace (including unit tests) then I think there would be some
interest in applying this to Digester - I certainly think that would be
useful.

Regards,

Simon



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message