You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ian Beaumont <ib...@categoric.com> on 2005/01/24 16:25:21 UTC
Dynamic XML Datasource in form
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