commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: [digester] setting a default value for a callMethod
Date Mon, 17 Mar 2003 21:34:52 GMT
On Tue, 2003-03-18 at 08:54, Erik Price wrote:
> Hmm... I'm wondering if there's a way to tell the digester that I don't 
> want to call that method if the element at the matching pattern is 
> empty?  Or is this getting too detailed, in which case I'd have to look 
> into JDOM or something.

I am not aware of any built-in digester functionality to do this.

However, one of the *features* of Digester is that you can write your
own Rule objects. So, you could write a class which implements Rule
which checks the attribute and only invokes your target method under
whatever conditions you feel are appropriate.

Just on a side-note, I am not sure that your XML design is entirely
sound. To me,

<foo>1</foo>  means "here is a foo, with value 1".
<foo/> means "here is a foo, with no value".

You appear to want to pretend that <foo/> doesn't exist - which doesn't
seem right to me. If <foo/> has no meaning, then why is it in the input
at all?

Regardless of the above digression, I think implementing a custom Rule
object should solve your problem.



View raw message