ETSI's Bug Tracker - Part 09: Using XML with TTCN-3
View Issue Details
0007210Part 09: Using XML with TTCN-3Technicalpublic29-10-2015 11:0904-12-2015 15:46
Gyorgy Rethy 
Gyorgy Rethy 
normalminorhave not tried
closedfixed 
v4.6.1 (published 2015-06) 
v4.7.1 (published 2016-07)v4.7.1 (published 2016-07) 
7.6.6.6 and B.3.21
L.M.Ericsson
0007210: How to decode an empty element when an optional sequence includes optional elements only
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.
No tags attached.
docx CR7210_resolution_v1.docx (63,553) 29-10-2015 11:54
http://oldforge.etsi.org/mantis/file_download.php?file_id=3332&type=bug
docx CR7210_resolution_v2.docx (65,389) 04-11-2015 11:11
http://oldforge.etsi.org/mantis/file_download.php?file_id=3357&type=bug
Issue History
29-10-2015 11:09Gyorgy RethyNew Issue
29-10-2015 11:37Gyorgy RethyDescription Updatedbug_revision_view_page.php?rev_id=194#r194
29-10-2015 11:45Gyorgy RethyDescription Updatedbug_revision_view_page.php?rev_id=195#r195
29-10-2015 11:54Gyorgy RethyFile Added: CR7210_resolution_v1.docx
29-10-2015 11:55Gyorgy RethyDescription Updatedbug_revision_view_page.php?rev_id=196#r196
03-11-2015 16:49Gyorgy RethyAssigned To => Axel Rennoch
03-11-2015 16:49Gyorgy RethyStatusnew => assigned
03-11-2015 16:50Gyorgy RethyNote Added: 0013481
04-11-2015 11:11Axel RennochFile Added: CR7210_resolution_v2.docx
04-11-2015 11:13Axel RennochNote Added: 0013484
04-11-2015 11:13Axel RennochAssigned ToAxel Rennoch => Gyorgy Rethy
04-11-2015 11:13Axel RennochStatusassigned => confirmed
04-11-2015 13:56Gyorgy RethyStatusconfirmed => resolved
04-11-2015 13:56Gyorgy RethyFixed in Version => v4.7.1 (published 2016-07)
04-11-2015 13:56Gyorgy RethyResolutionopen => fixed
04-11-2015 14:05Gyorgy RethyProduct Version => v4.6.1 (published 2015-06)
04-11-2015 14:05Gyorgy RethyTarget Version => v4.7.1 (published 2016-07)
04-12-2015 15:46Gyorgy RethyNote Added: 0013560
04-12-2015 15:46Gyorgy RethyStatusresolved => closed

Notes
(0013481)
Gyorgy Rethy   
03-11-2015 16:50   
STF discussion: agreed in pronciple. Review proposed solution.
(0013484)
Axel Rennoch   
04-11-2015 11:13   
Just some minor formatting issues solved in resolution_v2.
(0013560)
Gyorgy Rethy   
04-12-2015 15:46   
Added to draft V4.6.3