When xjc version "2.2.3-hudson-jaxb-ri-2.2-70-" is used subsequently two times, it generates two different compile results. Issue is that XML marshalled by java files from xjc compile result 1 is different (and wrong) from XML file mashalled by java files from xjc compile result 2.
Difference in result XMLs is occurence/not occurence on namespace prefix ns2:
<Activity Id="Id task1" Name="Task 1">
<Implementation>
<ns2:Task/>
</Implementation>
</Activity>
Difference in java code, responsible for different resulting XMLs, is different order in @XMLElements.
With the following order, namespace prefix occurs in the result XML:
@XmlElements({
@XmlElement(name = "BlockActivity", namespace = "http://www.wfmc.org/2002/XPDL1.0", type = org.wfmc._2002.xpdl1.BlockActivity.class),
@XmlElement(name = "BlockActivity", type = org.wfmc._2008.xpdl2.BlockActivity.class),
With the following order, namespace prefix does NOT occur in the result XML:
@XmlElements({
@XmlElement(name = "BlockActivity", type = org.wfmc._2008.xpdl2.BlockActivity.class),
@XmlElement(name = "BlockActivity", namespace = "http://www.wfmc.org/2002/XPDL1.0", type = org.wfmc._2002.xpdl1.BlockActivity.class),
I compile bpmnxpdl_31.xsd
xjc.bat -verbose -no-header c:\TEMP\bpmnxpdl_31.xsd -b c:\TEMP\binding.xjb
with binding.xjb:
<jxb:bindings node="xsd:element[@name='Activity']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Status']/xsd:simpleType">
<jxb:typesafeEnumClass name="Status"/>
</jxb:bindings>
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='StartMode']/xsd:simpleType">
<jxb:typesafeEnumClass name="StartMode"/>
</jxb:bindings>
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='FinishMode']/xsd:simpleType">
<jxb:typesafeEnumClass name="FinishMode"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='ActivitySet']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='AdHocOrdering']/xsd:simpleType">
<jxb:typesafeEnumClass name="AdHocOrdering"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='Artifact']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='ArtifactType']/xsd:simpleType">
<jxb:typesafeEnumClass name="ArtifactType"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='Assignment']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='AssignTime']/xsd:simpleType">
<jxb:typesafeEnumClass name="AssignTime"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='Association']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='AssociationDirection']/xsd:simpleType">
<jxb:typesafeEnumClass name="AssociationDirection"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='BasicType']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Type']/xsd:simpleType">
<jxb:typesafeEnumClass name="Type"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='BlockActivity']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='View']/xsd:simpleType">
<jxb:typesafeEnumClass name="View"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='Condition']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Type']/xsd:simpleType">
<jxb:typesafeEnumClass name="Type"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='ConformanceClass']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='GraphConformance']/xsd:simpleType">
<jxb:typesafeEnumClass name="GraphConformance"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='ConformanceClass']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='BPMNModelPortabilityConformance']/xsd:simpleType">
<jxb:typesafeEnumClass name="BPMNModelPortabilityConformance"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='DataMapping']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Direction']/xsd:simpleType">
<jxb:typesafeEnumClass name="Direction"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='Deadline']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Execution']/xsd:simpleType">
<jxb:typesafeEnumClass name="Execution"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='EndEvent']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Result']/xsd:simpleType">
<jxb:typesafeEnumClass name="Result"/>
</jxb:bindings>
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Implementation']/xsd:simpleType">
<jxb:typesafeEnumClass name="Implementation"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='EndPoint']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='EndPointType']/xsd:simpleType">
<jxb:typesafeEnumClass name="EndPointType"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='FormalParameter']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Mode']/xsd:simpleType">
<jxb:typesafeEnumClass name="Mode"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='Icon']">
<jxb:bindings node="./xsd:complexType/xsd:simpleContent/xsd:extension/xsd:attribute[@name='SHAPE']/xsd:simpleType">
<jxb:typesafeEnumClass name="SHAPE"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='IntermediateEvent']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Trigger']/xsd:simpleType">
<jxb:typesafeEnumClass name="Trigger"/>
</jxb:bindings>
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Implementation']/xsd:simpleType">
<jxb:typesafeEnumClass name="Implementation"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='Join']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Type']/xsd:simpleType">
<jxb:typesafeEnumClass name="Type"/>
</jxb:bindings>
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='ExclusiveType']/xsd:simpleType">
<jxb:typesafeEnumClass name="ExclusiveType"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='Loop']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='LoopType']/xsd:simpleType">
<jxb:typesafeEnumClass name="LoopType"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='LoopMultiInstance']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='MI_Ordering']/xsd:simpleType">
<jxb:typesafeEnumClass name="MI_Ordering"/>
</jxb:bindings>
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='MI_FlowCondition']/xsd:simpleType">
<jxb:typesafeEnumClass name="MI_FlowCondition"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='LoopStandard']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='TestTime']/xsd:simpleType">
<jxb:typesafeEnumClass name="TestTime"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='ParticipantType']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Type']/xsd:simpleType">
<jxb:typesafeEnumClass name="Type"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='Pool']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Orientation']/xsd:simpleType">
<jxb:typesafeEnumClass name="Orientation"/>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='ProcessHeader']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='DurationUnit']/xsd:simpleType">
<jxb:typesafeEnumClass name="DurationUnit">
<jxb:typesafeEnumMember value="M" name="Month" />
<jxb:typesafeEnumMember value="m" name="Minute" />
</jxb:typesafeEnumClass>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="xsd:element[@name='StartEvent']">
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Trigger']/xsd:simpleType">
<jxb:typesafeEnumClass name="Trigger"/>
</jxb:bindings>
<jxb:bindings node="./xsd:complexType/xsd:attribute[@name='Implementation']/xsd:simpleType">
<jxb:typesafeEnumClass name="Implementation"/>
</jxb:bindings>
</jxb:bindings>
Is there a way to get stable order of @XMLElements in subsequent runs of XJC?