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

Michael Wechner michael.wechner at wyona.com
Tue Dec 15 16:54:43 CET 2009


Michael Wechner wrote:
> 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)

or as an alternative one could have something like

Node.setType(int type)

WDYT?

Thanks

Michi
>
> WDYT?
>
> Thanks
>
> Michi



More information about the Yanel-development mailing list