commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ederson Marcos Ferreira <>
Subject Betwixt: Working with chain lists
Date Tue, 31 Jan 2006 15:48:47 GMT

I've been using Betwixt to convert xml file in JavaBeans. But I've
found some problems.
I have 4 classes: Config, Arrow, Tip and ElementB. In accordance with
the XML file below, inside of element 'elementA' I may have several
'arrow' elements and inside of element 'arrow' I may have several
'tip' elements, and after 'elementA' I have an 'elementB'. This works
almost perfectly, because Config class, used in the registerBeanClass
(reader.registerBeanClass(new InputSource(dotBetwixtDocument),
Config.class)), is constructed with the elements 'arrow'(which is a
List in Config class) and 'elementB', but for the element 'tip'(which
is a List in Arrow class) doesn't work. The classes have to follow a
hierarchy and the classes can't be separate. The attribute 'tip' in
class Arrow is empty. In the end the Config class should be constructed
following the structure below:

Config class
	private ElementB elementB; (it's OK!!!)
	private List arrows; (which should be populated with instances of
Arrow - it's OK!!!)

	public Config() {
		this.arrows = new ArrayList();

	public List getArrows() {
		return this.arrows;

	public void addArrow(Arrow arrow) {

Arrow class
	private String att1; (it's OK!!!)
	private String att2; (it's OK!!!)
	private String att3; (it's OK!!!)
	private List tips; (which should be populated with instances of Tip -
but doesn't work!!! - this is the point, it's empty)

	public Arrow() {
		this.arrows = new ArrayList();

	public List getTips() {

	public void addTip(Tip tip) {;

What it happens?
Thank's very much.
Ederson Ferreira

My XML file follows the structure below:
		   <arrow att1="X" att2="Y" att3="Z">
			 <tip att4="W" att5="true" att6="false" />
			 <tip att4="U" att5="false" att6="true" />

		   <arrow att1="K" att2="L" att3="M">
			 <tip att4="R" att5="true" att6="false" />
			 <tip att4="S" att5="false" att6="true" />
   <elementB att7="Q" />

My .betwixt document, inside application:
<?xml version='1.0' encoding='UTF-8' ?>
<info primitiveTypes='attribute'>
   <element name='config'>

	   <element name='elementA'>
		   <element name='arrow'
			   <attribute name='att1' property='att1'/>
			   <attribute name='att2' property='att2'/>
			   <attribute name='att3' property='att3'/>

			   <element name='tip'
					   <attribute name='att4' property='att4'/>
					   <attribute name='att5' property='att5'/>
					   <attribute name='att6' property='att6'/>


	   <element name='elementB'
		   <attribute name='att7' property='att7'/>


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

View raw message