cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Murray Cassie <cassie...@yahoo.com>
Subject Re: Dynamic XML Datasource in form
Date Tue, 25 Jan 2005 09:48:43 GMT
Hi Ian,

we do something like this in the flowscript:
function dataEdit()
{
var form = new Form("cocoon:/definition_data"); 
// we have a pipeline for definition_data
form.loadXML("cocoon:/bind_data");
//  we have a pipeline for bind_data
  	do {
form.showForm("template_data");
//  we have a pipeline for template_data
	} 
while (!form.isValid);
	cocoon.sendPage("dummy.html");
}

sitemap snippet for bind_data:
<map:match pattern="bind_data">
<map:generate type="data_generator" />
<map:transform type="xslt"
src="stylesheets/form_binding.xsl"/>
<map:serialize type="xml" mime-type="text/xml"/>
</map:match>

We have a generator that generates xml that we
transform to the simple xml binding we need.

Hope this helps
Cheers
Cassie

--- Ian Beaumont <ibeaumont@categoric.com> wrote:

> System:Cocoon 2.1.6
>  
> I'm looking at the form2simpleXML form flow example,
> and trying to
> modify it so that the source document isn't a fixed
> XML document - but
> can be generated from another pipeline (in my case
> it will come from
> eXist - XML DB).
>  
> First off - I tried to add a generator in to the
> sitemap (in this
> example I'm still using a static doc):
>  
>      <map:match pattern="form2simpleXML.flow">
>        <map:generate
> src="forms/form2_simple_data.xml"/>
>        <map:call function="handleForm">
>          <map:parameter name="function"
> value="form2simpleXML"/>
>          <map:parameter name="form-definition"
> value="forms/form2_model.xml"/>
>          <map:parameter name="documentURI"
> value="forms/form2_simple_data.xml"/>
>        </map:call>
>      </map:match>
> 
> but then cannot see how I would change the 
> binding_example.js call to:
> form.loadXML(documentURI);
> to use the document from the pipeline.  It also
> gives about the
> generator already being set when I try to access the
> page, so I think
> this may not me the correct approach.
>  
> My second solution was to try to use the cocoon
> protocol as the source
> of the xml document - so I changed the sitemap as
> follows:
>      <map:match pattern="test.xml">
>        <map:generate
> src="forms/form2_simple_data.xml"/>
>        <map:serialize type="xml"/>
>       </map:match>
>      
>      <map:match pattern="_form2simpleXML.flow">
>        <map:call function="handleForm">
>          <map:parameter name="function"
> value="form2simpleXML"/>
>          <map:parameter name="form-definition"
> value="forms/form2_model.xml"/>
>          <map:parameter name="documentURI"
> value="cocoon:/test.xml"/>
>        </map:call>
>  
> Although this didn't generate any errors - the
> generated form wasn't
> pre-populated from the XML.
>  
> Help!
>  
> TIA
> Ian
>  
>  
> 



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

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


Mime
View raw message