Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting JSON to XML does not reproduce the same order of elements #140

Closed
kovax opened this issue Mar 6, 2019 · 0 comments
Closed

Converting JSON to XML does not reproduce the same order of elements #140

kovax opened this issue Mar 6, 2019 · 0 comments
Labels
bug Something isn't working outcomeinit issue for the outcomeinit package
Milestone

Comments

@kovax
Copy link
Member

kovax commented Mar 6, 2019

This JSON

{
  "Device_Details":{
    "Name":"dsd",
    "DeviceType":"IBA-Cyclone",
    "Site":"6fa15a62-95ec-4fdc-a082-87dc0df8cf8d",
    "DeviceLabel":[]
  }
}

... is converted to this XML where the Site and DeviceType is switched order:

<Device_Details>
  <Name>dsd</Name>
  <Site>6fa15a62-95ec-4fdc-a082-87dc0df8cf8d</Site>
  <DeviceType>IBA-Cyclone</DeviceType>
</Device_Details>

The full error message:

ItemRoot.requestTransition() postData:{"Device_Details":{"Name":"dsd","DeviceType":"IBA-Cyclone","Site":"6fa15a62-95ec-4fdc-a082-87dc0df8cf8d","DeviceLabel":[]}}
XML: 
<Device_Details><Name>dsd</Name><Site>6fa15a62-95ec-4fdc-a082-87dc0df8cf8d</Site><DeviceType>IBA-Cyclone</DeviceType></Device_Details>
XSD: 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Device_Details">
    <xs:annotation>
      <xs:documentation>Details of Device item</xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="1" minOccurs="1" name="Name" type="xs:string">
          <xs:annotation>
            <xs:appinfo>
              <dynamicForms>
                <required>true</required>
              </dynamicForms>
            </xs:appinfo>
          </xs:annotation>
        </xs:element>
        <xs:element maxOccurs="1" minOccurs="0" name="DeviceType">
          <xs:annotation>
            <xs:appinfo>
              <dynamicForms>
                <required>false</required>
              </dynamicForms>
              <listOfValues>
                <values>GE-PETtrace,IBA-Cyclone,GE-Target_C11,GE-Target_F18,GE-Target_F2,IBA-Target_F18,GE-GasTargetFiller,GE-LiquidTargetFiller,AAA-TransferSystem,IBA-TransferSystem,GE-Module_MX,GE-Module_FX,GE-Module_FL,ORA-Module_NEP,TRASIS-Module_AIO,IBA-Module_SYN,IASON-Module_Iflu,AAA-Dispenser,Tema-Dispenser,DoseCalibrator,Balance,Pump,ParticleCounter,IT-device,QC-Device,OtherDevice</values>
              </listOfValues>
            </xs:appinfo>
          </xs:annotation>
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:enumeration value="GE-PETtrace"/>
              <xs:enumeration value="IBA-Cyclone"/>
              <xs:enumeration value="GE-Target_C11"/>
              <xs:enumeration value="GE-Target_F18"/>
              <xs:enumeration value="GE-Target_F2"/>
              <xs:enumeration value="IBA-Target_F18"/>
              <xs:enumeration value="GE-GasTargetFiller"/>
              <xs:enumeration value="GE-LiquidTargetFiller"/>
              <xs:enumeration value="AAA-TransferSystem"/>
              <xs:enumeration value="IBA-TransferSystem"/>
              <xs:enumeration value="GE-Module_MX"/>
              <xs:enumeration value="GE-Module_FX"/>
              <xs:enumeration value="GE-Module_FL"/>
              <xs:enumeration value="ORA-Module_NEP"/>
              <xs:enumeration value="TRASIS-Module_AIO"/>
              <xs:enumeration value="IBA-Module_SYN"/>
              <xs:enumeration value="IASON-Module_Iflu"/>
              <xs:enumeration value="AAA-Dispenser"/>
              <xs:enumeration value="Tema-Dispenser"/>
              <xs:enumeration value="DoseCalibrator"/>
              <xs:enumeration value="Balance"/>
              <xs:enumeration value="Pump"/>
              <xs:enumeration value="ParticleCounter"/>
              <xs:enumeration value="IT-device"/>
              <xs:enumeration value="QC-Device"/>
              <xs:enumeration value="OtherDevice"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element maxOccurs="1" minOccurs="1" name="Site" type="xs:string">
          <xs:annotation>
            <xs:appinfo>
              <dynamicForms>
                <required>false</required>
              </dynamicForms>
              <listOfValues>
                <scriptRef>Site_QueryActiveSiteList:0</scriptRef>
              </listOfValues>
            </xs:appinfo>
          </xs:annotation>
        </xs:element>
        <xs:element maxOccurs="unbounded" minOccurs="0" name="DeviceLabel">
          <xs:annotation>
            <xs:documentation>Custom Device Label up to 20 rows</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="1" minOccurs="1" name="Label" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <dynamicForms>
                      <required>false</required>
                    </dynamicForms>
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element maxOccurs="1" minOccurs="1" name="Value" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <dynamicForms>
                      <required>false</required>
                    </dynamicForms>
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
EXCEPTION:org.cristalise.kernel.common.InvalidDataException: IDL:org.cristalise.kernel/common/InvalidDataException:1.0  level:ERROR msg:cvc-complex-type.2.4.a: Invalid content was found starting with element 'DeviceType'. One of '{DeviceLabel}' is expected.
@kovax kovax added bug Something isn't working outcomeinit issue for the outcomeinit package labels Mar 6, 2019
@kovax kovax added this to the 4.0.0 milestone Mar 6, 2019
kovax added a commit that referenced this issue Mar 6, 2019
kovax added a commit that referenced this issue Mar 6, 2019
kovax added a commit that referenced this issue Mar 6, 2019
@kovax kovax closed this as completed Mar 7, 2019
kovax added a commit that referenced this issue Mar 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working outcomeinit issue for the outcomeinit package
Projects
None yet
Development

No branches or pull requests

1 participant