[Yanel-dev] SitetreeDOMImpl or rather NodeDOMImpl has an issue re isCollection

Michael Wechner michael.wechner at wyona.com
Tue Dec 15 16:36:26 CET 2009


Hi

I just realized that the Sitetree/Node DOM implementation

src/impl/java/org/wyona/yanel/impl/navigation/NodeDOMImpl.java

has an issue re the isCollection()/isResource() method. It is based on 
an XML, e.g.

  <node name="brands" url="/brands.html">
    <label>List of all brands</label>

    <node name="scotch-and-soda">
      <label>Scoth &amp; Soda</label>
    </node>
  <node name="diesel"><label>Diesel</label></node></node>

and when creating a new child and one should have to specify the node 
type (either collection or resource), then
it's not clear what node type, because the method appendChild(Node) has 
no such argument
and the methods isCollection() of the DOM implementation is just 
checking if there children.

Of course there is the workaround that if it is supposed to be a 
collection, then create a child for this node, which
will make it implicitely a collection. But that's not very nice :-(

Hence I would suggest to change the API by introducing a method 
appendChild(Node, NodeType)

WDYT?

Thanks

Michi


More information about the Yanel-development mailing list