You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Markus Härnvi <ja...@harnvi.net> on 2006/04/06 13:15:18 UTC
[Betwixt] Same bean in two places fails when reading
Hi!
I have a tree structure with composite derived beans. The beans
(implementing the Item interface) can have one or more ItemDependencies,
referencing any Item in the tree structure.
Item.java:
List dependencies;
List items;
addDependency(ItemDependency d)
List getDependencies()
addItem(Item i)
List getItems()
ItemDependency.java:
Item target;
setTarget(Item i)
Item getTarget()
When writing the tree to XML it works perfect, but when reading the bean
is correctly added to the ItemDependency object, but it will not show up
in the composite tree.
Here is a small subset of the XML:
Writing:
<?xml version='1.0' ?>
<item className="foo.items.Composite" id="1">
<items>
<item className="foo.items.PageItem" id="2">
<items>
<item className="foo.items.LeafItem" id="3">
<dependencies>
<dependency className="foo.ItemDependency" id="4">
<items/>
<target className="foo.items.LeafItem" id="5">
<dependencies/>
<items/>
</target>
</dependency>
</dependencies>
<items/>
</item>
<item idref="5"/>
</items>
</item>
</items>
</item>
After reading the XML and writing it again:
<?xml version='1.0' ?>
<item className="foo.items.Composite" id="1">
<items>
<item className="foo.items.PageItem" id="2">
<items>
<item className="foo.items.LeafItem" id="3">
<dependencies>
<dependency className="foo.ItemDependency" id="4">
<items/>
<target className="foo.items.LeafItem" id="5">
<dependencies/>
<items/>
</target>
</dependency>
</dependencies>
<items/>
</item> <--- Missing idref=5
</items>
</item>
</items>
</item>
If I remove the ItemDependency it can handle any tree I throw at it.
Any help would be welcome.
/Markus
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org