geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <james_strac...@yahoo.co.uk>
Subject Re: [vote] XML Parsing
Date Wed, 03 Sep 2003 13:07:04 GMT

On Tuesday, September 2, 2003, at 11:22  pm, Dain Sundstrom wrote:

> On Tuesday, September 2, 2003, at 07:44 AM, James Strachan wrote:
>
>> On Tuesday, September 2, 2003, at 12:56  am, Dain Sundstrom wrote:
>>> I think we should just use Digester directly.
>>
>> Why?
>
> The introspection makes me wary.  If they change the rules, all of our 
> stuff breaks.

What do you mean 'they'. We're talking about getters, setters & adder 
methods here. I can't see the Java Beans spec changing any time soon.


>  Besides that, I think the "digester glue" code you complain about 
> below is simple to read and understand.

Go right ahead if you want - I'm just offering us not having to write 7 
different digesters for the 7 J2EE schemas.

Note that Digester only goes from XML -> your rules -> beans. Not the 
other way around which we may need.



>>> Betwixt looks interesting but I don't see why we need it.
>>
>> It defaults the Digester rules for you - provided you follow some 
>> real simple naming conventions (getters, setters, adders).
>
> What happens when you have exceptions and non trivial mappings.  For 
> example, I have a place where I named an xml attribute named "class", 
> but the class attribute is named "name" because the spec calls it that 
> (and the spec is wrong).

Betwixt just makes a special kind of Digester. Its still a Digester so 
you can still happily add any wierd/wacky rules you want. Also for 
doing simple property / XML changes there's a little .betwixt mapping 
XML file you can do this with. Though I doubt we'll need to worry about 
that - we can just code the beans right (so they use the same property 
names as the XML elements/attributes).


>>> I wrote some digester code the handle mbean description files in 
>>> about 20 minutes (without knowing anything about Digester).
>>
>> Betwixt auto-defaults the Digester rules using introspection so it 
>> saves writing all that Digester glue. Also note that Digester is read 
>> only - it cannot generate XML. Betwixt defaults digester rules to 
>> parse XML and can generate XML from the beans if required.
>
> Cool.  Can Digester do this or does digester do something special to 
> make it happen?

No. Thats what betwixt is for - its the other half of digester  - to 
allow beans to generate XML - and as an automatic way of generating 
digester rules from  beans which use getter / setter and adder methods.

James
-------
http://radio.weblogs.com/0112098/


Mime
View raw message