commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Hauser <>
Subject Re: [Digester] HashMap on top of stack
Date Wed, 11 Feb 2004 10:49:55 GMT
Hello Simon

Thank you (and Robert) for your responses. I implemented a Rule with the 
following end() method:

    public void end(String namespace, String name) throws Exception {
        DefinitionBean bean = (DefinitionBean) getDigester().peek(0);
        HashMap hashMap = ((HashMap) getDigester().peek(1));
        hashMap.put(bean.getKey(), bean);

It's simple and only suitable for my task, but it works. Thank you a lot.


Simon Kitching wrote:

>>the first is to create a custom Rule implementation. this should be  
>>very easy in this case (just put the code you've already got into begin  
>>and then get the ordering right).
>Yep, creating a Rule to solve this specific problem shouldn't be hard. 
>Digester is *designed* to allow users to add custom rules.
>Christian: as Robert said, your pseudocode is pretty good already. You
>really just need to declare a class extending Rule, then put your
>pseudocode into the end() method. 
>Note that digester.peek(0) returns top-of-stack (newest object), and
>digester.peek(1) returns next-to-top (next-to-newest) object; this is
>probably tidier than your pseudocode which used pop() and push().

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

View raw message