Hi all,
I am mapping the XPDL 1.0 document, in which there is an element
DataField with the following xsd
<xsd:element name="DataField">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="xpdl:DataType"/>
<xsd:element ref="xpdl:InitialValue" minOccurs="0"/>
<xsd:element ref="xpdl:Length" minOccurs="0"/>
<xsd:element ref="xpdl:Description" minOccurs="0"/>
<xsd:element ref="xpdl:ExtendedAttributes"
minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="Id" type="xsd:NMTOKEN"
use="required"/>
<xsd:attribute name="Name" type="xsd:string"/>
<xsd:attribute name="IsArray" default="FALSE">
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="TRUE"/>
<xsd:enumeration value="FALSE"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="DataType">
<xsd:complexType>
<xsd:group ref="xpdl:DataTypes"/>
</xsd:complexType>
</xsd:element>
<xsd:group name="DataTypes">
<xsd:choice>
<xsd:element ref="xpdl:BasicType"/>
<xsd:element ref="xpdl:DeclaredType"/>
<xsd:element ref="xpdl:SchemaType"/>
<xsd:element ref="xpdl:ExternalReference"/>
<xsd:element ref="xpdl:RecordType"/>
<xsd:element ref="xpdl:UnionType"/>
<xsd:element ref="xpdl:EnumerationType"/>
<xsd:element ref="xpdl:ArrayType"/>
<xsd:element ref="xpdl:ListType"/>
</xsd:choice>
</xsd:group> The following are 2 example elements
<DataField Id="Partial_Ship_Status" IsArray="FALSE">
<DataType>
<DeclaredType Id="Business_Example_Typ2"/>
</DataType>
<InitialValue>OK</InitialValue>
<Description>possible values are: "OK" and
"NOT_OK"</Description>
</DataField>
<DataField Id="No_Of_Stocked_Items" IsArray="FALSE">
<DataType>
<BasicType Type="INTEGER"/>
</DataType>
<InitialValue>0</InitialValue>
<Description>The number of the stocked items of the
product that customer ordered</Description>
</DataField>
Here is my binding
<mapping name="DataField"
class="xs.workflow.xpdl10.DataField">
<namespace uri=" http://www.wfmc.org/2002/XPDL1.0"
default="elements" />
<structure name="DataType">
<structure field="dataType" usage="required"
type="xs.workflow.xpdl10.DataType" />
</structure>
<value name="InitialValue" field="initialValue"
usage="optional" />
<value name="Length" field="length" usage="optional" />
<value name="Description" field="description"
usage="optional" />
<collection name="ExtendedAttributes"
field="extendedAttributes"
usage="optional"
item-type="xs.workflow.xpdl10.ExtendedAttribute" />
<value name="Id" field="id" usage="required"
style="attribute" />
<value name="Name" field="name" usage="optional"
style="attribute" />
<value name="IsArray" field="isArray" usage="optional"
style="attribute" />
</mapping>
<mapping class="xs.workflow.xpdl10.DataType"
abstract="true">
<namespace uri=" http://www.wfmc.org/2002/XPDL1.0"
default="elements" />
</mapping>
<mapping name="DeclaredType" class="
xs.workflow.xpdl10.DeclaredType"
extends="xs.workflow.xpdl10.DataType">
<namespace uri="http://www.wfmc.org/2002/XPDL1.0 "
default="elements" />
<value ident="ref" name="Id" field="id" usage="required"
style="attribute" />
</mapping>
<mapping name="EnumerationType"
class="xs.workflow.xpdl10.EnumerationType"
extends="xs.workflow.xpdl10.DataType">
<namespace uri=" http://www.wfmc.org/2002/XPDL1.0"
default="elements" />
<collection field="enumerationValueList">
<structure map-as="
xs.workflow.xpdl10.EnumerationValue"></structure>
</collection>
</mapping> ....
, which has the structure (just with
field="dataType") nested in another structure (just with
name="DataField").
I cannot find similar structure-nested-structure structure on
JiBX's help documents, but I cannot find other
solution for xsd. I can successly compile the mapping but I have
a run time error seen below. The JiBX I use is
version 1.0.1.
as.util.ParseException: No unmarshaller defined for class
at index 17
at
xs.workflow.xpdl10.PackageTransformer.transform(PackageTransformer.java:40)
at xs.workflow.xpdl10.PackageTransformer
.<init>(PackageTransformer.java:30)
at
xs.workflow.WorkflowBuilder.getPackage(WorkflowBuilder.java:66)
at
xs.workflow.xpdl10.PackageTransformerTest.testCase1(PackageTransformerTest.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect (TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java
:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.jibx.runtime.JiBXException: No unmarshaller
defined for class at index 17
at
org.jibx.runtime.impl.UnmarshallingContext.getUnmarshaller(UnmarshallingContext.java:2425)
at
xs.workflow.xpdl10.JiBX_C__projects_XS_workflow_src_java_xs_workflow_xpdl10_bindingDataType_access.unmarshal
()
at
xs.workflow.xpdl10.DataField.JiBX_C__projects_XS_workflow_src_java_xs_workflow_xpdl10_binding_unmarshal_1_2(DataField.java)
at
xs.workflow.xpdl10.JiBX_C__projects_XS_workflow_src_java_xs_workflow_xpdl10_bindingDataField_access.unmarshal
()
at
xs.workflow.xpdl10.JiBX_MungeAdapter.JiBX_C__projects_XS_workflow_src_java_xs_workflow_xpdl10_binding_unmarshal_1_16()
at
xs.workflow.xpdl10.Package.JiBX_C__projects_XS_workflow_src_java_xs_workflow_xpdl10_binding_unmarshal_1_0
(Package.java)
at
xs.workflow.xpdl10.JiBX_C__projects_XS_workflow_src_java_xs_workflow_xpdl10_bindingPackage_access.unmarshal()
at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java
:2569)
at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2729)
at
xs.workflow.xpdl10.PackageTransformer.transform(PackageTransformer.java:37)
... 18 more
Any solution?
Regards,
Rice