geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <>
Subject Re: [XML Parsing]
Date Tue, 02 Sep 2003 12:47:59 GMT

On Monday, September 1, 2003, at 02:28  pm, Aaron Mulder wrote:

> On Mon, 1 Sep 2003, James Strachan wrote:
>> If we go the POJO route (as described in the [vote] XML Parsing  
>> thread)
>> then using Betwixt (which uses Digester) is my preferred route. We can
>> then let Xerces take care of the XSD validation.
> 	I'm new to Betwixt, but it looks like we have two options.  One is
> to define a .betwixt file for every POJO

No thats only if you want to customize things on a per class basis

> , and the other is to have one big
> class which sets up all the Betrixt mappings in code.

No. By default Betwixt will do this all for you using sensible defaults.

> I was hoping for
> the middle solutions -- one mapping file listing all of the mappings.
> Which path do you recommend?

Out of the box Betwixt can handle the marshalling for you. You can  
instantiate your own XMLIntrospector and customize it to how you want  
the XML to look (e.g. for J2EE its to use elements rather than  
attributes and so forth). Then just go right ahead and marshall.

A good example to see it in action is commons-sql...

here are the 2 simple classes to wrap up the use of betwixt for  
marshalling in / out of XML... 

then here are the POJOs... 

Doing something similar should be pretty easy and save us having to  
hand-craft digester rules.


View raw message