cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: Access to XML bean elements in flowscript/javaflow
Date Sun, 06 Aug 2006 19:23:02 GMT

> Hello all
> 
> I have studied the binding examples in the cocoon forms block 
> and have build another simple example, in that the user can 
> enter a number and gets back the square of the number. This 
> example works pretty good as long as I use a JavaScriptBean 
> or a JavaBean. When I use an XML bean, I don't know how to 
> get access to the element stored in the XML bean.
> 
> In the binding examples of cocoon, I found examples how to 
> store the entire bean in a document or in an XML file. But 
> this doesn't help me.
> 
> Here is a part of my flowscript:
> 
> function square() {
>   var form = new Form("fields.xml");
>   form.createBinding("binding.xml");
>   var quadrat;
> 
>   var bean = createBean();
>   form.load(bean);
>   form.showForm("formtemplate-page");
>   form.save(bean);
> 
>   // How do I get access to the bean element beannumber ??
> 
>   var number = bean["/root/beannumber"];
> 

Use bean.lookupWidget : http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/formmodel/Widget.html

Regards Ard 


>   var squar = number * number;
>   cocoon.sendPage("result-page", {"square" : square});
> 
> The form.load passes without any error. In the form, I get 
> the value form the file data.xml.
> 
> Here is my binding.xml:
> 
> <?xml version="1.0"?>
> <fb:context
>   xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
>   xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
>   path="/">
>   <fb:value id="number" path="beannumber">
>     <fd:convertor datatype="long"/>
>   </fb:value>
> </fb:context>
> 
> Here is my data.xml:
> 
> ?xml version="1.0"?>
> <root>
>   <beannumber>5</beannumber>
> </root>
> 
> Could you please explain me how to get access to the XML 
> bean? How do I get access when I use javaflow?
> 
> Thanks
> 
>   Saskia
> 
> 
> 
> -- 
> 
> 
> Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit!
> "Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message