Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 3058 invoked from network); 16 Jun 2003 11:07:23 -0000 Received: from unknown (HELO madimc2.indra.es) (213.170.46.14) by daedalus.apache.org with SMTP; 16 Jun 2003 11:07:23 -0000 Received: from madarrclex5.indra.es ([192.168.10.22]) by madimc2.indra.es with Microsoft SMTPSVC(5.0.2195.5329); Mon, 16 Jun 2003 13:07:02 +0200 Received: from indra.es ([192.168.168.19]) by madarrclex5.indra.es with Microsoft SMTPSVC(5.0.2195.5329); Mon, 16 Jun 2003 13:06:54 +0200 Message-ID: <3EEDA508.8080703@indra.es> Date: Mon, 16 Jun 2003 13:07:52 +0200 From: =?ISO-8859-1?Q?Jos=E9_Antonio_P=E9rez_Testa?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030507 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: Digester References: <01f401c33021$74bad080$2b7aeb9d@pgh.symbol.com> In-Reply-To: <01f401c33021$74bad080$2b7aeb9d@pgh.symbol.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 16 Jun 2003 11:06:55.0028 (UTC) FILETIME=[658E7740:01C333F7] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Following "http://www.onjava.com/lpt/a/2746" reference: "Note that it is possible to register several rules for the same pattern. If this occurs, the rules are executed in the order in which they are added to the Digester." You are entering rules in the wrong order, the line : _digester.addSetNext( "jdo-config/jdo-providers/jdo/connection", "setConnection", "com.symbol.mc.struts.plugin.common.ConnectionConfig"); must be the last one for this path. I think addSetNext must be allways the last one for a given path. I wold write: _digester.addObjectCreate( "jdo-config/jdo-providers/jdo", "com.symbol.mc.struts.plugin.jdo.JDOConfig"); _digester.addSetProperties( "jdo-config/jdo-providers/jdo"); _digester.addObjectCreate( "jdo-config/jdo-providers/jdo/connection", "com.symbol.mc.struts.plugin.common.ConnectionConfig"); _digester.addSetProperties("jdo-config/jdo-providers/jdo/connection"); _digester.addSetNext( "jdo-config/jdo-providers/jdo/connection", "setConnection", "com.symbol.mc.struts.plugin.common.ConnectionConfig"); This will create a JDOConfig on the stack and set its properties, after that create a ConnectionConfig on top of the stack and set its properties. Finally it will call setConnection on the JDOConfig object (stack's top) when popping from the ConnectionConfig from the stack. I hope this could help. Sloan Seaman wrote: >I'm having trouble getting the Digester to properly populate some java object and I was wondering if someone could help me out. > >It keeps trying to call setConnection() on my JDOPlugIn object when I want it to call setConnection() on my JDOConfig object. > >Help? > > >Here is my XML: > > > > driver="com.microsoft.jdbc.sqlserver.SQLServerDriver" > url="jdbc:microsoft:sqlserver://xx.xx.xx.xx:1433;DatabaseName=OMS;SelectMethod=cursor" > username="x" > password="x" > minPool="2" > maxPool="10" > /> > > value="/com/symbol/mc/oms/jdo/xorm-db.xml"/> > value="/com/symbol/mc/oms/jdo/bean.jdo"/> > value="false"/> > > > > > >And here is my code: >private void process(InputStream _is) > throws IllegalAccessException, IOException, SAXException > { > Digester digester = new Digester(); > digester.push(this); > addRuleInstances(digester); > digester.parse(_is); > } > > private void addRuleInstances(Digester _digester) { > _digester.addSetProperties( > "jdo-config/jdo-providers"); > _digester.addSetNext( > "jdo-config/jdo-providers", > "addJDOConfig", > "com.symbol.mc.struts.plugin.jdo.JDOConfig"); > > _digester.addObjectCreate( > "jdo-config/jdo-providers/jdo", > "com.symbol.mc.struts.plugin.jdo.JDOConfig"); > _digester.addSetProperties( > "jdo-config/jdo-providers/jdo"); > _digester.addSetNext( > "jdo-config/jdo-providers/jdo/connection", > "setConnection", > "com.symbol.mc.struts.plugin.common.ConnectionConfig"); > _digester.addSetNext( > "jdo-config/jdo-providers/jdo/providerSpecific", > "setProviderSpecific", > "com.symbol.mc.struts.plugin.common.ProviderSpecificConfig"); > > _digester.addObjectCreate( > "jdo-config/jdo-providers/jdo/connection", > "com.symbol.mc.struts.plugin.common.ConnectionConfig"); > _digester.addSetProperties( > "jdo-config/jdo-providers/jdo/connection"); > > _digester.addObjectCreate( > "jdo-config/jdo-providers/jdo/providerSpecific", > "com.symbol.mc.struts.plugin.common.ProviderSpecificConfig"); > _digester.addCallMethod( > "jdo-config/jdo-providers/jdo/providerSpecific/property", > "addProperty", 2); > _digester.addCallParam( > "jdo-config/jdo-providers/jdo/providerSpecific/property", > 0, > "name"); > _digester.addCallParam( > "jdo-config/jdo-providers/jdo/providerSpecific/property", > 1, > "value"); > } > > >________________________________________________________________________ >This email has been scanned for all viruses by the MessageLabs Email >Security System. For more information on a proactive email security >service working around the clock, around the globe, visit >http://www.messagelabs.com >________________________________________________________________________ > >