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

Michael Wechner michael.wechner at wyona.com
Wed Dec 16 22:41:14 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)

I have fixed this now by changing appendChild(Node) to appendChild(Node, 
int)

whereas int is for example Node.COLLECTION or Node.RESOURCE

I have changed all dependencies which I am aware of and at least Hudson 
seems to be fine with it
but strictly speaking I broke backwards compatibility re custom 
implementations if such existed.

Please let me know if you have any problem with it.

Thanks

Michi
>
> WDYT?
>
> Thanks
>
> Michi



More information about the Yanel-development mailing list