cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ZongoZongo <nroe...@gmx.net>
Subject Re: Formtdefinition and -template from a org.w3c.dom.Document stream
Date Mon, 15 Jan 2007 10:03:06 GMT

Creating the form works fine. But the pipeline makes some trouble with
parsing the template:
"org.xml.sax.SAXException: The object type: class java.lang.String could not
be serialized to XML:"

Do I have to consider anything special? My template is valid and works fine
if I use it conventionally  :-/

<div>
  <jx:import xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml" />
  <ft:form-template xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
method="POST" enctype="multipart/form-data"
action="#{$continuation/id}.continue">
    <ft:widget id="faults">
      <fi:styling xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
list-type="checkbox" />
    </ft:widget>
    <br />
    <ft:widget id="comment">
      <fi:styling xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
type="textarea" cols="20" rows="5" />
    </ft:widget>
    <br />
    <ft:widget id="submitbutton" />
  </ft:form-template>
</div>

kind regards,

Niclas




Jason Johnston-3 wrote:
> 
> ZongoZongo wrote:
>> Hi
>> 
>> Inside the flow I get the formtemplate and the formdefinition from a
>> javamethod as an org.w3c.dom.Document stream. How can I use this streams
>> to:
>> -  generate the form
> 
> I believe you can pass a DOM element to the Form flowscript constructor:
> 
> var form = new Form(myFormDocument.getDocumentElement());
> 
>> -  call the formtemplate
> 
> What you need here is a way to use the DOM Document as input to the JX 
> generator.  The xmodule source allows you to stream a DOM from an input 
> module, for instance using the flow-attribute module:
> 
> (flowscript:)
> form.showForm("display-pipeline", {dom : myJXDocument});
> 
> (sitemap:)
> <map:match pattern="display-pipeline">
>    <map:generate type="jx" src="xmodule:flow-attr:dom" />
>    ...
> 
> 
> Now, you should be aware that while this sort of setup is certainly 
> possible, there will be a performance penalty.  First of all, using a 
> DOM object to build the form definition prevents the caching of that 
> definition that usually takes place.  Similarly, the JX template cannot 
> be precompiled and cached so it has to recompile the template each time. 
>   You'll have to determine if that performance penalty is worth it for 
> your particular case.
> 
> Hope that helps
> --Jason
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Formdefinition-and--template-from-an-org.w3c.dom.Document-stream-tf2945399.html#a8369117
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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


Mime
View raw message