admin-shell / aasx-package-explorer

C# based viewer / editor for the Asset Administration Shell
39 stars 9 forks source link

Incorrect XML De-/Serialization of more than one Qualifier #45

Closed zrgt closed 1 year ago

zrgt commented 1 year ago

Incorrect XML De-/Serialization of Qualifiers for Version V2.0.1 of Metamodel.

Current behavior

Currently if I have more than one Qualifier it will be serialized like this:

<aas:qualifier>
  <aas:qualifier>
    <aas:type>test1</aas:type><aas:valueType>string</aas:valueType><aas:value>test1</aas:value>
  </aas:qualifier>
  <aas:qualifier>
    <aas:type>test2</aas:type><aas:valueType>string</aas:valueType><aas:value>test2</aas:value>
  </aas:qualifier>
</aas:qualifier>

Expected behavior

However I suppose that the correct serialization will be the following:

<aas:qualifier>
  <aas:qualifier>
    <aas:type>test1</aas:type><aas:valueType>string</aas:valueType><aas:value>test1</aas:value>
  </aas:qualifier>
</aas:qualifier>
<aas:qualifier>
  <aas:qualifier>
    <aas:type>test2</aas:type><aas:valueType>string</aas:valueType><aas:value>test2</aas:value>
  </aas:qualifier>
</aas:qualifier>

According to the Schema qualifiable does NOT have a complex type named "qualifier" similiar to list. Instead it has multiple "qualifier" elements of type "constraint_t":

    <complexType name="qualifier_t">
        <sequence>
            <element maxOccurs="1" minOccurs="1" name="type" type="aas:qualifierType_t"/>
            <element maxOccurs="1" minOccurs="1" name="valueType" type="aas:dataTypeDef_t"/>
            <element maxOccurs="1" minOccurs="0" name="valueId" type="aas:reference_t"/>
            <element maxOccurs="1" minOccurs="0" name="value" type="aas:valueDataType_t"/>
            <group ref="aas:hasSemantics"/>
        </sequence>
    </complexType>
    ...
    <complexType name="constraint_t">
        <choice>
            <element maxOccurs="1" minOccurs="0" name="formula" type="aas:formula_t"/>
            <element maxOccurs="1" minOccurs="0" name="qualifier" type="aas:qualifier_t"/>
        </choice>
    </complexType>
    ...
    <group name="qualifiable">
        <sequence>
            <element maxOccurs="unbounded" minOccurs="0" name="qualifier" type="aas:constraint_t"/>
        </sequence>
    </group>
zrgt commented 1 year ago

Issue in the new repo: https://github.com/admin-shell-io/temp-aasx-package-explorer/issues/99