Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 4751 invoked from network); 1 Feb 2005 20:36:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Feb 2005 20:36:09 -0000 Received: (qmail 87098 invoked by uid 500); 1 Feb 2005 20:36:04 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 87076 invoked by uid 500); 1 Feb 2005 20:36:03 -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 87063 invoked by uid 99); 1 Feb 2005 20:36:03 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from 87.52.220-216.q9.net (HELO mail.futurebrandexp.com) (216.220.52.87) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 01 Feb 2005 12:36:02 -0800 Received: from p001002 ([204.225.84.27]) by mail.futurebrandexp.com with Microsoft SMTPSVC(5.0.2195.5329); Tue, 1 Feb 2005 15:40:34 -0500 Message-ID: <043901c5089e$46ba5a00$7703d00a@hypermedia.com> From: "Luke Shannon" To: "Jakarta Commons Users List" References: <032d01c507ee$eb20e6a0$7703d00a@hypermedia.com> <38e8470105013116182138a728@mail.gmail.com> <039d01c50876$f1269d50$7703d00a@hypermedia.com> <03f801c50888$a8244190$7703d00a@hypermedia.com> <029a01c50894$bac6a610$28ad93d1@irm.local> <042201c50898$b84814b0$7703d00a@hypermedia.com> <032401c5089b$50ded0e0$28ad93d1@irm.local> Subject: Re: Need a little help Date: Tue, 1 Feb 2005 15:40:33 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-OriginalArrivalTime: 01 Feb 2005 20:40:34.0008 (UTC) FILETIME=[47110580:01C5089E] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Success! Thanks Wendy. This is what worked, outside of a few small changes syntax changes, your thinking is exactly correct. public TreeMap digest() throws IOException, SAXException { digester = new Digester(); digester.setValidating(false); digester.addObjectCreate("DATA/VERSION", TreeMap.class); digester.addCallMethod("DATA/VERSION/ITEM", "put", 2); digester.addCallParam("DATA/VERSION/ITEM", 0, "NAME"); digester.addCallParam("DATA/VERSION/ITEM", 1); return (TreeMap)digester.parse(parseMe); } Luke ----- Original Message ----- From: "Wendy Smoak" To: "Jakarta Commons Users List" Sent: Tuesday, February 01, 2005 3:19 PM Subject: Re: Need a little help > From: "Luke Shannon" > > > public TreeMap digest() throws IOException, SAXException { > > digester = new Digester(); > > digester.setValidating(false); > > digester.addObjectCreate("DATA/VERSION", "createTreeMap"); > > An ObjectCreateRule needs to know the type of object to create, not a method > to call. You need to let Digester create an object and push it on the > stack, and calling createTreeMap won't do that. > > > digester.addSetProperties("DATA/VERSION/ITEM", "NAME", "name"); > > digester.addCallMethod("DATA/VERSION/ITEM", "addItem", 0); > > return fieldsValues; > > } > > I thought... > digester = new Digester(); > digester.setValidating(false); > digester.addObjectCreate("DATA/VERSION", "TreeMap.class"); > digester.addCallMethod("DATA/VERSION/ITEM", "put", 2); > digester.addCallParam("DATA/VERSION/ITEM", 0, "NAME"); > digester.addCallParam("DATA/VERSION/ITEM", 1); > return digester.parse(file); > > It should create a TreeMap and then call 'put' with the value of the NAME > attribute and the body of the tag as the name/value pair. Some of > the method params may be switched around, double check the signatures. > > HTH, > -- > Wendy Smoak > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org