cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ZongoZongo <>
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  :-/

  <jx:import xmlns:jx=""
uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml" />
  <ft:form-template xmlns:ft=""
method="POST" enctype="multipart/form-data"
    <ft:widget id="faults">
      <fi:styling xmlns:fi=""
list-type="checkbox" />
    <br />
    <ft:widget id="comment">
      <fi:styling xmlns:fi=""
type="textarea" cols="20" rows="5" />
    <br />
    <ft:widget id="submitbutton" />

kind regards,


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:
> For additional commands, e-mail:

View this message in context:
Sent from the Cocoon - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message