Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 30545 invoked from network); 11 Feb 2004 10:50:54 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 11 Feb 2004 10:50:54 -0000 Received: (qmail 7102 invoked by uid 500); 11 Feb 2004 10:50:19 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 7027 invoked by uid 500); 11 Feb 2004 10:50:18 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 7000 invoked from network); 11 Feb 2004 10:50:18 -0000 Received: from unknown (HELO mail04.agrinet.ch) (81.221.250.53) by daedalus.apache.org with SMTP; 11 Feb 2004 10:50:18 -0000 Received: from active.ch (217.192.238.66) by mail04.agrinet.ch (7.0.024) (authenticated as c.hauser) id 40224C8A000CDF52 for commons-user@jakarta.apache.org; Wed, 11 Feb 2004 11:50:31 +0100 Message-ID: <402A08D3.30306@active.ch> Date: Wed, 11 Feb 2004 11:49:55 +0100 From: Christian Hauser User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: [Digester] HashMap on top of stack References: <4028E2DE.7020709@active.ch> <1076452634.8145.273.camel@pcsimon.ecnnz.ecnetwork.co.nz> In-Reply-To: <1076452634.8145.273.camel@pcsimon.ecnnz.ecnetwork.co.nz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org