commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <>
Subject Re: [Betwixt] Options for doing a roundtrip
Date Mon, 02 Feb 2004 22:52:30 GMT
On 2 Feb 2004, at 03:20, Cheong Chung Onn wrote:

> Thanks robert,
> I have learnt that Betwixt is bean centric the hard way over the last 
> few days and i have "opened" all the Interface classes. Even though I 
> have been working round the clock trying to work around Betwixt's  
> bean centric-ism but am defeated, I still find Betwixt very 
> interesting, flexible and powerful.

interesting, flexible, powerful but incomplete would be an apt 

(the following isn't meant to be a rant or a criticism of yourself, i'm 
just trying to let people know how to maximize the changes of people 
being able to help them.)

i would have liked to give you more help but i only have a few hours 
each day to spend on coding betwixt. i try to maximize the progress i 
can make in this time.

people will massively increase their chances of a positive outcome if 
they are willing to contribute good test cases to the ASF demonstrating 
their problems. (it usually takes me longer to understand and create 
good test cases than it does to add the feature or fix the problem.) 
this means posting the code with ASF licenses indicating that they are 
happy to donate the code to the ASF.

with a good test case, i can usually quickly come back with either help 
or a bug fix and so i'll usually find time to do that.

(end of message ;)

> I have only one last struggle with Betwixt, actually i have given up 
> since early this morning, but i wonder if you can help point  me to 
> the right direction. Here's my problem - Betwixt seems to favor xml 
> files that are attribute based, hence any Custom Class Creator 
> (subclass of ChainBeanCreator) can only access the "elements" that are 
>  in the form of "attributes"  via mappingElement.getAttributes(). Is 
> it possible for me to access the child element values during the call 
> back to the CustomCreator class? I don't seems to able to find a 
> solution, i tried navigating the elementDescriptor, the readContext 
> but failed.  I only managed to access the definition of the bean type 
> but not the content. Could you kindly advise me if there is a way to 
> access the contents of the child element - <age> content as shown 
> below during the CustomClass callback?

i'm sad to say that this is actually pretty difficult (i'll give the 
reasons below). i'd say that the easiest way to do something like this 
would be by a custom digester rule (or two).

betwixt is very much SAX-based. the information you want is not 
available until later in the parse. this is fine for bean-centric 
object models but is a PITA when you want to map a sub-graph to a 
single call (whether to a construction or to a method). i do use the 
kind of constructors and method you're having problems with fairly 
regularly and it would be possible to extend betwixt so that it 
supports them but it's not currently high on my list of priorities.

betwixt combines pretty well with digester rules and usually the folks 
who use betwixt have experience of digester so the usual way to solve 
this problem is to get betwixt to ignore the subgraph and add custom 
digester rules to manage it.

once again, my apologies that betwixt hasn't been able to do what you 

- robert

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message