The xml file is like this <Class1> <code>1</code> <Class2> <name>test</name> </Class2> </Class1> <Class1> <code>2</code> <Class3> <type>aType</type> </ Class3> </Class1> And I can't change this format. When I create the rules to Class2 I don't know how to access de properties in the parent tag. For the example, I don't have access to the tag code.
-----Mensaje original----- De: Fabian Sergio de Rosa [mailto:[EMAIL PROTECTED] Enviado el: Wednesday, August 09, 2006 3:36 PM Para: Jakarta Commons Users List Asunto: Re: Digester and Inheritance <Class2> <propfromclass1>value</propfromclass1> <propfromclass2>value</propfromclass2> </Class2> <Class3> <propfromclass1>value</propfromclass1> <propfromclass3>value</propfromclass3> </Class3> you don't need to declare your Class1 in the xml file. and you must add the rules to set using api or xmlrules.xml 2006/8/9, German Balbastro <[EMAIL PROTECTED]>: > > Yes, the class have the getter and setter methods, but i donĀ“t know how to > access to the properties of the parent tags in the xml file. > > -----Mensaje original----- > De: James Carman [mailto:[EMAIL PROTECTED] > Enviado el: Wednesday, August 09, 2006 2:47 PM > Para: 'Jakarta Commons Users List' > Asunto: RE: Digester and Inheritance > > Since Class2 extends Class1, it inherits the properties of > Class1. Digester > will be able to set the properties for you with no problems. You did > actually give those properties setters/getters, didn't you? > > > > -----Original Message----- > From: German Balbastro [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 09, 2006 1:40 PM > To: Jakarta Commons Users List > Subject: RE: Digester and Inheritance > > Yes, I don't know how to creates an instance of Class2 when found the > tag Class2 and set the properties of class1 in Class2. > For example: > Class Class1{ > String code > } > Class Class2 extends Class1{ > String name; > } > Class Class3 extends Class1{ > String type; > } > And de xml: > <Class1> > <code>1</code> > <Class2> > <name>test</name> > </ Class2> > </Class1> > <Class1> > <code>2</code> > <Class3> > <type>aType</type> > </ Class3> > </Class1> > My generate object class2 need to have both properties setted (code=1 > and name=test) and the object class3 = {code=2, tye=atype} > > -----Mensaje original----- > De: James Carman [mailto:[EMAIL PROTECTED] > Enviado el: Wednesday, August 09, 2006 2:29 PM > Para: 'Jakarta Commons Users List' > Asunto: RE: Digester and Inheritance > > Can't you add a create rule with a path of Class1/Class2 for Class2 and > a > create rule for Class1/Class3 for Class3? > > > -----Original Message----- > From: German Balbastro [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 09, 2006 1:19 PM > To: commons-user@jakarta.apache.org > Subject: Digester and Inheritance > > I have an object model whith an abstract parent class Class1 and two > implementations Class2 and Clas3. > > I don't know how i can create the implementations. > > For example i have this xml file: > > <Class1> > ... fields of class1 ... > <Class2> > ... fields of class2 ... > > </ Class2> > </ Class1> > <Class1> > ... fields of class1 ... > <Class3> > ... fields of class3 ... > > </ Class3> > </ Class1> > For this example, digester should create one instance of Class2 and one > instance of Class3, and in both cases setter the attributes for the > class and for inheritance for the parent class. > > I need to know how to create the digester's rules. > > Thanks > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]