commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [betwixt] How to get mixed-content of element?
Date Mon, 24 Feb 2003 18:12:05 GMT
On Friday, February 21, 2003, at 09:06 PM, Pat wrote:

> Hi,

hi pat

> I've searched the mailing list for this one and maybe I'm missing 
> something
> very obvious, but - is it possible to get the text of mixed element 
> content
> with betwixt?
>
> e.g.
>
>   <foo>
>     <bar>blah</bar>
>     This is text...
>   </foo>
>
> In this case I'll have a class for Foo and bar will be mapped to a String
> property of Foo.  But what happens to the text?

there's three answers to this question at three different levels.

the simplest answer is no, not at the moment.

betwixt builds on digester for bean reading. digester is a rule based xml 
-> object mapper from here in the commons. digester is powerful and 
flexible but this comes at the cost of setting up (and in some cases 
coding) the rules. betwixt extends digester but is more declarative, 
describing the mapping and aims to make the most common use cases easy.

so, since betwixt extends digester you can add a rule which will do 
something constructive with that text. (you'll probably want to move up to 
CVS HEAD if you want to do this since the support for this has been 
improved since the alpha release.)

then again, if there is a common xml->bean use case for the body text, 
then it could be added to the to do list for betwixt.

> Off topic - I am very happy with Betwixt so far (just started playing 
> with it)
> and I have high hopes that it will eliminate the need for maintaining my 
> own
> tool (based on the SAXModelBuilder example from my book).

there still a lot of work to do on betwixt. (take a look at the to do list 
- all patches gratefully received!) the code's also a hard to understand 
and work on at the moment so refactoring's one of our priorities.

- robert


Mime
View raw message