ZongoZongo wrote:
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  :-/

That's strange... are you sure your JX template source object is a DOM Document? The error message suggests it's actually a String.

If it's a String then the module source should work rather than xmodule:
<map:generate src="module:flow-attr:jx" />



<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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






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

Reply via email to