commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertdon...@mac.com>
Subject Re: earth to digester
Date Fri, 02 Nov 2001 21:58:59 GMT

On Friday, November 2, 2001, at 09:48 PM, Jason van Zyl wrote:

> On 11/2/01 3:44 PM, "Scott Sanders" <sanders@totalsync.com> wrote:

<snip>

>> That's Castor all right.  I suppose we could start down that road, but I'
>> m
>> not sure why we would want to re-invent the wheel, since Castor is even 
>> 2
>> way.
>
> I decided 6 months ago that I was going to use digester for everything 
> XML.
> I looked at Castor and the Digester and Castor seemed rather complex. I 
> also
> will always favour an apache product, and it seems that robert has a rule
> that will do what I need. To boot, Craig is meticulous with the code that 
> he
> releases and is highly responsive to requests for change so I'm not really
> interested in looking at Castor anymore.

jason
you might want to give this a spin.
(i'll come back later with a better version and a test case later)

you'll need to use the ExtendedBaseRules, and so you'll need something like

digester.setRules(new ExtendedBaseRules);

you need to use a child match rule something like

digester.addRule("alpha/?", new BeanPropertySetterRule(digester));

this should set properties with names matching the names of child elements 
of <alpha> with the body text of those elements.

eg.

<alpha>	
	...
	<beta>Text</beta>
	...
</alpha>

will set property beta with 'Text' on the top object on the stack (which 
should be alpha).

in other words, what you wanted.

and without changing digester :)


- robert

<Attachment missing>
Mime
View raw message