commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Keese <>
Subject Re: [digester] Can rules be re-used?
Date Thu, 20 Jan 2005 00:58:30 GMT
I see. Although an XML file containing rules is clearly read-only (thus
corresponding to the traditional english-language meaning of "rule"), I
guess the "Rule" class is more like a "tag processor", or something like
that. Well, it would be easy to write Rule classes if Digester
instantiated a new Rule object for each element it processed. But since
the Rule objects are reused, it gets tricky.

Simon Kitching wrote:

>>If there is only one Rule to process <foo> elements (matching pattern
>>*/foo), won't bodyText get mangled?
>For those which have a Stack member: no. This will work fine
>"recursively", but will fail in multi-threaded environments.
Hmm, if you go so far as to use a stack, you might as well store the
stack in the calling Digester object rather than in the Rule object.
That would make the Rule object stateless and thus thread safe.

Of course, you would also need to get rid of the Digester back-reference.


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

View raw message