commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <>
Subject Re: [betwixt] Custom bean creation
Date Mon, 18 Apr 2005 20:10:02 GMT
On Mon, 2005-04-18 at 15:05 +0930, Lance Semmens wrote:
> I'm wanting to use my own logic to instantiate beans from XML elements.
> After reading the doco, it seems that the way to do this is to create a
> ChainedBeanCreator and add it to the BeanCreationChain.
> I am writing my own ChainedBeanCreator but I can't see how to access the
> body of an XML element in the 
> create(ElementMapping mapping, ReadContext context, BeanCreationChain chain)
> method. 
> When i say "the body of an xml element" i mean "bar" part of
> "<foo>bar</foo>".

betwixt is sax-based. this has several implications for the
architecture. the bean creation chain stuff is intended to help solve
the problem of what object to create when faced with the initial element
info set. this would allow you to do something clever when faced with
the element <foo>. however, being SAX, you cannot read forward to find
out what the mixed content (for example 'bar') is.

a different mechanism is therefore required to support object creation
based on mixed content (or indeed, full info set). this is something
that i've wanted to add for a long time and have a good idea how to do
it but i'm unlikely to get it done any time soon. (my main priority at
the moment is fixing commons-logging which is difficult and that may
take quite a while.)

i can give you some instructions about how you can solve your the
problem in the narrow or (if you feel like contributing to betwixt), we
can talk about ways to solve this problem in the general :)

i'll leave it up to you... 

- robert 

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

View raw message