On Tue, 2003-09-09 at 18:44, Geronimo Ma. Hernandez wrote:
> Don't know if our solution is elegant, but it works also for the example.xml
> from Petra.
> We have a similar situation:
>
> <map name="map1">
> <item value="value1" name="name1"/>
> <item value="value2" name="name2"/>
> </map>
>
> with various "named" maps and the value should be an Integer.
>
> We solved this with an ObjectCreationFactory, which creates the map.
> As this rule cares about the object-stack in the end-method, we add the map to
> the parent in the begin()-method of the ObjectCreationFactory (no
> addSetNext()-call is needed).
> The begin()-method of the ObjectCreationFactory gets the name of the map in
> the attributes-array (accessible with attributes.getValue("name"); ), so we
> can use a standard put()-call of a map.
Yep, that looks like a fine idea to me. Wish I had thought of it :-)
This certainly solves Petra's problem [with about 10 lines of code?].
I still think it would be nice for CallMethodRule to be able to target
objects other than top-of-stack, but this approach does reduce the
necessity for it somewhat.
Maybe we somehow need to collect these "design patterns" of Digester
use?
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]