Logo etsi

ETSI's Bug Tracker

Notice: information submitted on the ETSI issue Tracker may be incorporated in ETSI publication(s) and therefore subject to the ETSI IPR policy.

View Revisions: Issue #7210 All Revisions ] Back to Issue ]
Summary 0007210: How to decode an empty element when an optional sequence includes optional elements only
Revision 29-10-2015 11:55 by Gyorgy Rethy
Description The XSD element below :
<xsd:element name="optionals_in_optional">
  <xsd:complexType>
    <xsd:sequence minOccurs="0">
      <xsd:element name="elem1" type="xsd:string" minOccurs="0"/>
      <xsd:element name="elem2" type="xsd:integer" minOccurs="0"/>
      <xsd:element name="elem3" type="xsd:decimal" minOccurs="0"/>
      <xsd:element name="elem4" type="xsd:dateTime" minOccurs="0"/>
      <xsd:element name="elem5" type="xsd:duration" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>


will be translated to TTCN-3 as:
type record Optionals_in_optional
{
    record {
        XSD.String elem1 optional,
        XSD.Integer elem2 optional,
        XSD.Decimal elem3 optional,
        XSD.DateTime elem4 optional,
        XSD.Duration elem5 optional
    } sequence optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (sequence) "untagged";
};

where the 'sequence' name of the record shall not be present in the encoded XML value.

This is not the problem at encoding, both
template Optionals_in_optional t_optionals1 := { sequence := omit }
and
template Optionals_in_optional t_optionals2 := {
  sequence := {
    elem1 := omit,
    elem2 := omit,
    elem3 := omit,
    elem4 := omit,
    elem5 := omit
  }
}

will be encoded as an empty <optionals_in_optional></optionals_in_optional> element.

However, it is NOT SPECIFIED, how the above incoming element shall be decoded into TTCN-3. Therefore the user needs to define a template list containing both templates above to be sure that the incoming empty element will match. This is cumbersome and superflouos.

Proposed solution: it is proposed to specify that this specific case shall be decoded to the value { sequence := omit }; this is the shortest and thus more user friendly solution.
Note: it could cause backward incompatibility if code is written to tool-specific decoding, and causes no backward compatibility for code written to ba standard-compliant.
Revision 29-10-2015 11:45 by Gyorgy Rethy
Description The XSD element below :
<xsd:element name="optionals_in_optional">
  <xsd:complexType>
    <xsd:sequence minOccurs="0">
      <xsd:element name="elem1" type="xsd:string" minOccurs="0"/>
      <xsd:element name="elem2" type="xsd:integer" minOccurs="0"/>
      <xsd:element name="elem3" type="xsd:decimal" minOccurs="0"/>
      <xsd:element name="elem4" type="xsd:dateTime" minOccurs="0"/>
      <xsd:element name="elem5" type="xsd:duration" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>


will be translated to TTCN-3 as:
type record Optionals_in_optional
{
    record {
        XSD.String elem1 optional,
        XSD.Integer elem2 optional,
        XSD.Decimal elem3 optional,
        XSD.DateTime elem4 optional,
        XSD.Duration elem5 optional
    } sequence optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (sequence) "untagged";
};

where the 'sequence' name of the record shall not be present in the encoded XML value.
This is not the problem at encoding, both
template Optionals_in_optional t_optionals1 := { sequence := omit }
and
template Optionals_in_optional t_optionals2 := {
  sequence := {
    elem1 := omit,
    elem2 := omit,
    elem3 := omit,
    elem4 := omit,
    elem5 := omit
  }
}

will be encoded as an empty <optionals_in_optional></optionals_in_optional> element.

However, it is NOT SPECIFIED, how the above incoming element shall be decoded into TTCN-3. Therefore the user needs to define a template list containing both templates above to be sure that the incoming empty element will match. This is cumbersome and superflouos.

Proposed solution: it is proposed to specify that this specific case shall be decoded to the value { sequence := omit }; this is the shortest and thus more user friendly solution.
Note: it could cause backward incompatibility if code is written to tool-specific decoding, and causes no backward compatibility for code written to ba standard-compliant.
Revision 29-10-2015 11:37 by Gyorgy Rethy
Description The XSD element below :
<xsd:element name="optionals_in_optional">
  <xsd:complexType>
    <xsd:sequence minOccurs="0">
      <xsd:element name="elem1" type="xsd:string" minOccurs="0"/>
      <xsd:element name="elem2" type="xsd:integer" minOccurs="0"/>
      <xsd:element name="elem3" type="xsd:decimal" minOccurs="0"/>
      <xsd:element name="elem4" type="xsd:dateTime" minOccurs="0"/>
      <xsd:element name="elem5" type="xsd:duration" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>


will be translated to TTCN-3 as:
type record Optionals_in_optional
{
    record {
        XSD.String elem1 optional,
        XSD.Integer elem2 optional,
        XSD.Decimal elem3 optional,
        XSD.DateTime elem4 optional,
        XSD.Duration elem5 optional
    } sequence optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (elem1, elem2, elem3, elem4, elem5) "element";
variant (sequence) "untagged";
};

where the 'sequence' name of the record shall not be present in the encoded XML value.
This is not the problem at encoding, both
template Optionals_in_optional t_optionals1 := { sequence := omit }
and
template Optionals_in_optional t_optionals2 := {
  sequence := {
    elem1 := omit,
    elem2 := omit,
    elem3 := omit,
    elem4 := omit,
    elem5 := omit
  }
}

will be encoded as an empty <optionals_in_optional></optionals_in_optional> element.

However, it is NOT SPECIFIED, how the above incoming element shall be decoded into TTCN-3. Therefore the user needs to define a template list containing both templates above to be sure that the incoming empty element will match. This is cumbersome and superflouos.

Proposed solution: it is proposed to specify that this specific case shall be decoded to the value { sequence := omit }; this is the shortest and thus more user friendly solution.
Note: it could cause backward incompatibility if code is written to tool-specific decoding, and causes no backward compatibility for code written to ba standard-compliant.
Revision 29-10-2015 11:09 by Gyorgy Rethy
Description The XSD element below :
<xsd:element name="optionals_in_optional">
  <xsd:complexType>
    <xsd:sequence minOccurs="0">
      <xsd:element name="elem1" type="xsd:string" minOccurs="0"/>
      <xsd:element name="elem2" type="xsd:integer" minOccurs="0"/>
      <xsd:element name="elem3" type="xsd:decimal" minOccurs="0"/>
      <xsd:element name="elem4" type="xsd:dateTime" minOccurs="0"/>
      <xsd:element name="elem5" type="xsd:duration" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>


will be translated to TTCN-3 as:
type record Optionals_in_optional
{
    record {
        XSD.String elem1 optional,
        XSD.Integer elem2 optional,
        XSD.Decimal elem3 optional,
        XSD.DateTime elem4 optional,
        XSD.Duration elem5 optional
    } sequence optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (sequence) "untagged";
};

where the 'sequence' name of the record shall not be present in the encoded XML value.
This is not the problem at encoding, both
template Optionals_in_optional t_optionals1 := { sequence := omit }
and
template Optionals_in_optional t_optionals2 := {
  sequence := {
    elem1 := omit,
    elem2 := omit,
    elem3 := omit,
    elem4 := omit,
    elem5 := omit
  }
}

will be encoded as an empty <optionals_in_optional></optionals_in_optional> element.

However, it is NOT SPECIFIED, how the above incoming element shall be decoded into TTCN-3. Therefore the user needs to define a template list containing both templates above to be sure that the incoming empty element will match. This is cumbersome and superflouos.

Proposed solution: it is proposed to specify that this specific case shall be decoded to the value { sequence := omit }; this is the shortest and thus more user friendly solution.
Note: it could cause backward incompatibility if code is written to tool-specific decoding, and causes no backward compatibility for code written to ba standard-compliant.


MantisBT 1.2.14 [^]
Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker