On Tue, May 30, 2006 at 04:11:57PM +0200, Martijn C. Vos wrote:
> Is there an easy way to get the data for my tree widget from XML instead of a 
> file
> structure? I'm reading 
> http://cocoon.apache.org/2.1/userdocs/widgets/widget_tree.html
> and looking at the samples, and while I think basing a tree on an xml 
> structure is
> a very cocoon thing to do, I'm getting the impression I'd have to write that
> tree-model myself.
> 
> What I'd like to be able to do is something like:
> 
>     <fd:tree id="foo" selection="multiple|single">
>       <fd:tree-model type="xml" src="cocoon://tree.xml">
>         <fd:nodes xpath="//node" label="@name"/>
>       </fd:tree-model>
>     </fd:tree>
> 
> Or something along those lines. Doesn't sound too unreasonable, but it looks
> like it doesn't exist yet. Or am I wrong?

Hello Martijn,

We needed such an extension too at work. Based on
org.apache.cocoon.forms.formmodel.tree.DefaultTreeModel, I was able to create
a widget that reads its contents from an XML document. The current
implementation is a little ugly but it works. The widget parses the XML
document (using XOM) and then this document is transformed into the tree
structure used in DefaultTreeModel.

I'll send you the sources.

One improvement we need is the possibility to access extra data in the XML
document.

Fred

-- 
|E  R
| D  F
|
|fred at fredvos dot org
|5235 DG 52 NL +31 73 6411833

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to