Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 24424 invoked from network); 31 Jan 2005 23:44:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 31 Jan 2005 23:44:19 -0000 Received: (qmail 16787 invoked by uid 500); 31 Jan 2005 23:44:15 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 16749 invoked by uid 500); 31 Jan 2005 23:44:14 -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 16730 invoked by uid 99); 31 Jan 2005 23:44:14 -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; Mon, 31 Jan 2005 15:44:13 -0800 Received: from p001002 ([204.225.84.27]) by mail.futurebrandexp.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 31 Jan 2005 18:45:18 -0500 Message-ID: <032d01c507ee$eb20e6a0$7703d00a@hypermedia.com> From: "Luke Shannon" To: Subject: Need a little help Date: Mon, 31 Jan 2005 18:45:17 -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: 31 Jan 2005 23:45:18.0079 (UTC) FILETIME=[EB4648F0:01C507EE] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi; I am using Digester to extract some XML information. I have run into problems and need some help. Here is my schema: Category 4 Provider 11008 Name Description Company Who Posted 8 x.ppt The end result I would like to get is a TreeMap containing all the name attributes as keys and the contents of the item tags as values from a directory of XML files containing the above schema. I get the follow error when I try and run my program: Jan 31, 2005 6:24:18 PM org.apache.commons.digester.Digester endElement SEVERE: End event threw exception java.lang.NoSuchMethodException: No such accessible method: setContents() on object: Item This confuses me because the Item class does have this method. Below I have pasted my code. Here is the method that does the work: public Version digest() throws IOException, SAXException { digester = new Digester(); digester.setValidating(false); digester.addObjectCreate("DATA/VERSION", Version.class); digester.addObjectCreate("DATA/VERSION/ITEM", Item.class); digester.addSetProperties("DATA/VERSION/ITEM", "name", "name"); digester.addCallMethod("DATA/VERSION/ITEM", "setContents"); return (Version)digester.parse(parseMe); } Here is the Item class. The purpose of the class is to return a TreeMap for each item tag. public class Item { private String contents = new String(); private String name = new String(); public Item() { } /** * @param content The content to set. */ public void setName(String _name) { Trace.ENTER("Setting the name property to " + _name); this.name = _name; } public void setContents (String _contents) { this.contents = _contents; } public TreeMap getValues () { TreeMap map = new TreeMap(); map.put(name, contents); return map; } } Here is the Version class, it is contains a TreeMap which holds the data for all the item tags. /** * @author lshannon * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class Version { TreeMap fieldsValues; public Version() { fieldsValues = new TreeMap(); } /** * @return Returns the iTEMS. */ public TreeMap getMap() { return fieldsValues; } /** * @param items The iTEMS to set. */ public void setITEMS(TreeMap map) { fieldsValues.putAll(map); } } I am not that experienced with Digester. What I have looks to me like it should work, however maybe I am not understanding something. Is there any easier way to obtain my goal? Any help on this matter would be greatly appreciated. Luke --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org