commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Härnvi <j...@harnvi.net>
Subject [Betwixt] Same bean in two places fails when reading
Date Thu, 06 Apr 2006 11:15:18 GMT

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


Mime
View raw message