Bruno Dumon wrote:
On Thu, 2006-06-08 at 08:01 -0600, Jason Johnston wrote:
Antonio Gallardo wrote:
FWIW I think this might best be implemented in the Convertor layer, that
seems most appropriate for converting untrimmed strings to trimmed and
vice versa. A PlainStringConvertor for instance would keep
leading/trailing whitespace intact. WDYT?
If Fernando doesn't want to create a patch I will do so since this has
annoyed me in the past as well.
Cool!
If you do it on the convertor layer, it would mean that every convertor
needs to handle whitespace for itself. For example, a date field
containing just a space would currently be treated as an empty input,
while otherwise it would be up to the date convertor to detect this.
This probably isn't a huge problem, a simple trim() and empty string
check at the start of the existing convertors could solve this.
If you go for the convertor approach, I would suggest to make the
default string convertor configurable, instead of creating multiple
convertors.
For example, using a whitespace attribute that could have the following
values:
whitespace="preserve|trim|trim-left|trim-right"
and possibly a trim-if-all-whitespace attribute to force trimming in
case the input contains only whitespace.
FYI I just opened issue http://issues.apache.org/jira/browse/COCOON-1879
and attached a patch. I ended up going with your recommendation for a
whitespace="" attribute on fd:field rather than doing it in the
convertors; it's definitely the simpler approach, and less of a hassle
to maintain.
--Jason
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]