Hi,
I'm trying to use a union in my woody form. I've got no problem showing the
form, but when I try to save the document back to xml, I always get a
ClassCastException:
org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
org.apache.cocoon.ProcessingException: Error processing BindingWoodyApple:
java.lang.ClassCastException
I can't figure out what I'm doing wrong here.
I'm using a cvs head 2.1 updated today. I use the following parts in my
woody files:
Definition
<wd:new id="kedef"/>
<wd:class id="kedef">
<wd:widgets>
<wd:output id="type">
<wd:label>Widget Type</wd:label>
<wd:datatype base="string"/>
<wd:selection-list>
<wd:item value="X">
<wd:label>X-waarde</wd:label>
</wd:item>
<wd:item value="X_and_Y_value">
<wd:label>X and Y-value</wd:label>
</wd:item>
</wd:selection-list>
</wd:output>
<wd:union id="values" default="X_value" case="type">
<wd:datatype base="string"/>
<wd:label>Type</wd:label>
<wd:widgets>
<wd:struct id="X_value">
<wd:widgets>
<wd:field id="X">
<wd:label>X</wd:label>
<wd:datatype base="string"/>
</wd:field>
</wd:widgets>
</wd:struct>
<wd:struct id="X_and_Y_value">
<wd:widgets>
<wd:field id="X">
<wd:label>X</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="Y">
<wd:label>Y</wd:label>
<wd:datatype base="string"/>
</wd:field>
</wd:widgets>
</wd:struct>
</wd:widgets>
</wd:union>
</wd:widgets>
</wd:class>
Binding
<wb:new id="kedef"/>
<wb:class id="kedef">
<wb:javascript id="type" path="." direction="load">
<wb:load-form>
if (jxpathContext.getValue("Y") != null)
{
widget.setValue("X_and_Y_value");
}
else
{
widget.setValue("X");
}
</wb:load-form>
</wb:javascript>
<wb:union id="values" path=".">
<wb:case id="X" path=".">
<wb:struct id="X_value" path=".">
<wb:value id="X" path="X"/>
<wb:insert-node/>
</wb:struct>
</wb:case>
<wb:case id="X_and_Y_value" path=".">
<wb:struct id="X_and_Y_value" path=".">
<wb:value id="X" path="X"/>
<wb:value id="Y" path="Y"/>
<wb:insert-node/>
</wb:struct>
</wb:case>
</wb:union>
<wb:insert-node/>
</wb:class>
Template
<wt:new id="kedef"/>
<wt:class id="kedef">
<wt:widget id="type">
<wi:styling type="hidden"/>
</wt:widget>
<wt:union id="values">
<wt:case id="X">
<wt:struct id="X_value">
<wt:widget id="X"> <wi:styling size="4"/></wt:widget>
</wt:struct>
</wt:case>
<wt:case id="X_and_Y_value">
<wt:struct id="X_and_Y_value">
<wt:widget id="X"> <wi:styling size="4"/> </wt:widget>
<wt:widget id="Y"> <wi:styling size="8"/> </wt:widget>
</wt:struct>
</wt:case>
</wt:union>
</wt:class>
I bind with a simple context="root" and use the following data-file:
<root>
<X>5</X>
<Y>6</Y>
</root>
Thanks,
Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]