commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <>
Subject Re: [digester] Can rules be re-used?
Date Mon, 17 Jan 2005 01:26:20 GMT
On Sun, 16 Jan 2005 17:22:43 -0700, Wendy Smoak <> wrote:
> From: "Craig McClanahan" <>
> > The only restriction on reuse is that you can't use the same Digester
> > instance on two different threads at the same time.  Other than that,
> > you can reuse Rules instances as needed.
> Thanks.  [How on earth do you have time to do everything you do, and still
> answer user questions?!]

Alas, I only have time to answer the "most interesting" questions nowdays :-).

> I was hoping that would be the case, as I need to SetNestedProperties on
> just about everything, and I can't get the wildcards to work.
> After this
>     SetNestedPropertiesRule rule = new SetNestedPropertiesRule();
>     rule.setAllowUnknownChildElements(true);
> shouldn't I be able to just say
>     digester.addRule("*", rule);
> or (not sure yet)
>     digester.addRule("!*", rule);
> and have it try to set all the nested properties on whatever object is on
> top of the stack, on every pattern it finds?  All I get are a bunch of
>     New match='download/person'
>     No rules found matching 'download/person'.
> in the log file.

Wild cards in Digester are "prefix matches", not regular expressions. 
So, you'll need to add a rule (you can reuse the same instance) for
each tail element that you are processing:

    digester.addRule("*/download", rule);
    digester.addRule("*/person", rule);

> --
> Wendy Smoak


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message