commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wendy Smoak" <j...@wendysmoak.com>
Subject Re: [digester] Can rules be re-used?
Date Wed, 19 Jan 2005 03:56:21 GMT
From: "Simon Kitching" <skitching@apache.org>
> 3. One of Wendy's emails says this:
>
>    And now, this:
>         Digester digester = new Digester();
>         digester.setRules( new ExtendedBaseRules() );
>         digester.setValidating(false);
>         digester.addObjectCreate("download", WebUserImpl.class);
>         digester.addSetProperties("*");
>         SetNestedPropertiesRule rule = new SetNestedPropertiesRule();
>         rule.setAllowUnknownChildElements(true);
>         digester.addRule("*", rule);
>    tries to call setWhatever(...) on the object on the top of the stack 
> for
>    every pattern that didn't match anything else.
>
>    Perfect!  Thanks once again,
>
>  Well, as described above, using just "*" as the pattern will match only 
> elements
>  that don't match any other more explicit patterns. If that's what you 
> want, then
>  great - but you can do that with the default RulesBase rules.

Wait... I thought I tried to use "*" with the default RulesBase rules, and 
got nothing.  I then discovered (and Craig simultaneously posted) that you 
have to tell your Digester to use the ExtendedBaseRules before the wildcard 
will work.  Are you saying that "*" is supposed to work without
    digester.setRules( new ExtendedBaseRules() );
?  Or... how can you do the same thing with RulesBase?  (I _do_ just want it 
to call setWhatever() for patterns for which there isn't any other match.)

Thanks,
Wendy Smoak 



---------------------------------------------------------------------
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