On Tuesday, December 4, 2001, at 05:30 PM, Craig R. McClanahan wrote:
> On Tue, 4 Dec 2001, James Strachan wrote:
>
>> Date: Tue, 4 Dec 2001 16:43:56 -0000
>> From: James Strachan <james_strachan@yahoo.co.uk>
>> Reply-To: Jakarta Commons Developers List <commons-
>> dev@jakarta.apache.org>
>> To: Jakarta Commons Developers <commons-dev@jakarta.apache.org>
>> Subject: [digester] setting attributes & text content on the same
>> object...
>>
>> Has anyone found any ways to do the following in digester.
>>
>> Imagine the folllowing class
>>
>> public class Param {
>> public void setName(String name);
>> public void setValue(String name);
>> }
>>
>> And I want to parse XML like this...
>>
>> <param name="foo">bar</param>
>>
>> And I want the text value of the <param> element to be associated with
>> the
>> 'value' property of the Param.
<snip>
> This is courtesy of the (relatively) new SetPropertyRule -- Jason van Zyl
> ran into a need for this one, and suggested this approach.
hi craig
you mean the BeanPropertySetterRule, don't you?
> We could
> probably extend SetPropertyRule to work they way you want by grabbing the
> value from the body content if there is no "value" argument.
i think that you should be able to use the BeanPropertySetterRule to set a
specified property with the body text.
- robert
--
To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
|