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.

Christian


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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to