You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Juergen Weber <we...@hotmail.com> on 2003/06/26 14:31:34 UTC

Digester trims whitespace

Digester removes  leading or trailing whitespace.

What is a simple way to get the whitespace? Is there somewhere an example of 
a rule how to do that? I would like to read something like
<content>

blabla

</content>

inclusive the blank lines before and after blabla into a String.

Thank you,
Juergen

_________________________________________________________________
MSN Hotmail  -  Absolut kostenfrei! Der weltweit größte E-Mail-Anbieter im 
Netz:  http://www.msn.de/hotmail


Re: Digester trims whitespace

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 26 Jun 2003, Juergen Weber wrote:

> Date: Thu, 26 Jun 2003 14:31:34 +0200
> From: Juergen Weber <we...@hotmail.com>
> Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> To: commons-user@jakarta.apache.org
> Subject: Digester trims whitespace
>
> Digester removes  leading or trailing whitespace.
>

That behavior is based on the most common use case for Digester, which is
processing configuration files.

> What is a simple way to get the whitespace? Is there somewhere an example of
> a rule how to do that? I would like to read something like
> <content>
>
> blabla
>
> </content>
>
> inclusive the blank lines before and after blabla into a String.
>

You will need to write your own Rule implementation in order to do this.
The simplest thing (since the source is available) might be to copy one of
the existing rules that knows how to process the element body, and simply
omit the trim() method calls.

> Thank you,
> Juergen
>

Craig