Howdy, Thanks for your help: I actually figured it out yesterday but lost this thread so I couldn't post my solution. The property I was looking to set was a java.net.URL. When I changed it to a String things worked fine.
Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: Simon Kitching [mailto:[EMAIL PROTECTED] >Sent: Wednesday, November 19, 2003 6:24 PM >To: Jakarta Commons Users List >Subject: RE: [Digester] Question on CallMethodRule > >On Thu, 2003-11-20 at 07:43, Shapira, Yoav wrote: >> Howdy, >> That works perfectly!! Thanks so much ;) >> >> I have hopefully one final question. >> >> XML: >> <b attribute1="something" >> attribute2="something" >> attribtue3="something" /> >> >> Class B extends C. Class B has public methods setAttribute1 and >setAttribute2. The public setAttribute3 method is in the superclass, class >C. I use digester.addSetProperties("b"), but only attributes 1 and 2 >> are filled out. The setAttribute3 method is not called. >> >> Why does this happen? Is it the limitation noted on the digester javadoc >page, "Accessing Public Methods In A Default Access Superclass" ?? If so, >what is the work-around? > >hmm .. inherited attributes should be settable. > >SetPropertiesRule just uses BeanUtils.setProperty(.....) to do the >actual call to the setter method. > >There are two possibilities: >(a) >you have mis-spelled attribute3 in the above example. Is this just a >typo in the email, or really in the code? >(b) >properties must *really* comply with the JavaBeans spec. > >If you have > public void setFoo(String foo); > int getFoo(); >then this is not javabeans-compliant. You will then need to use >something like CallMethodRule rather than SetPropertiesRule. > >-- > >Re an earlier post of yours: > >On Thu, 2003-11-20 at 06:29, José Antonio Pérez Testa wrote: >> Hi Yoav, >> Your xml format has to be that one? >> With this other format the solution will be straightforward >> >> <a> >> <b class="package.class"> >> <foo>bar</foo> >> </b> >> </a> >> >> digester.addSetProperties("a/b"); >> > >The SetPropertiesRule maps xml *attributes* to java object properties. >So if your xml input is like this, then SetPropertiesRule will help: > <b class="package.class" foo="bar" who="me"/> > >If your xml looks like this, then SetPropertyRule is your friend: > <b class="package.class" > <property name="foo" value="bar"/> > <property name="who" value="me"/> > </b> > >And this style of xml: > <b class="package.class"> > <foo>bar</foo> > <who>me</who> > </b> >can be processed in two ways: > >* >BeanPropertySetterRule can be used to map elements like foo and who to >appropriate properties. However the pattern associated with the >BeanPropertySetterRule needs to match the child element (eg foo). >Therefore you must either know all the possible child elements in >advance and add a rule for each one (one for "foo", one for "who") or >use the ExtendedBaseRules with trailing wildcard pattern. > >* >SetNestedPropertiesRule can process the above xml without wildcard >patterns or explicitly specifying the child elements. However it was >added very recently (only yesterday!) so you'll need to use CVS - and >will be on the bleeding edge of Digester technology :-) > >Personally, I would recommend either using SetPropertiesRule (with >properties in xml attributes) or SetPropertyRule. But it all depends on >how adventurous you are... > > >Regards, > >Simon > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
