<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<link rel="stylesheet" type="text/css" href="http://oldforge.etsi.org/mantis/css/default.css" />
	<script type="text/javascript"><!--
		if(document.layers) {document.write("<style>td{padding:0px;}<\/style>")}
	// --></script>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Cache-Control" content="no-cache" />
	<meta http-equiv="Pragma-directive" content="no-cache" />
	<meta http-equiv="Cache-Directive" content="no-cache" />
	<meta http-equiv="Expires" content="Tue, 17 Dec 2024 09:18:32 GMT" />
	<link rel="shortcut icon" href="/mantis/images/favicon.ico" type="image/x-icon" />
	<link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Text Search" href="http://oldforge.etsi.org/mantis/browser_search_plugin.php?type=text" />	<link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Issue Id" href="http://oldforge.etsi.org/mantis/browser_search_plugin.php?type=id" />	<title>0005852: choice with optional content should be mapped to an optional union field - ETSI's Bug Tracker</title>
<script type="text/javascript" src="/mantis/javascript/min/common.js"></script>
<script type="text/javascript">var loading_lang = "Loading...";</script><script type="text/javascript" src="/mantis/javascript/min/ajax.js"></script>
</head>
<body>
<br /><table class="width100" cellspacing="1"><tr><td class="form-title" colspan="6"><div class="center">ETSI's Bug Tracker - Part 09: Using XML with TTCN-3</div></td></tr><tr><td class="form-title" colspan="6">View Issue Details</td></tr><tr><td class="print-spacer" colspan="6"><hr size="1" /></td></tr><tr class="print-category"><td class="print" width="16%">ID</td><td class="print" width="16%">Project</td><td class="print" width="16%">Category</td><td class="print" width="16%">View Status</td><td class="print" width="16%">Date Submitted</td><td class="print" width="16%">Last Update</td></tr><tr class="print"><td class="print">0005852</td><td class="print">Part 09: Using XML with TTCN-3</td><td class="print">Technical</td><td class="print">public</td><td class="print">22-12-2010 12:27</td><td class="print">13-07-2011 16:33</td></tr><tr><td class="print-spacer" colspan="6"><hr size="1" /></td></tr><tr class="print"><td class="print-category">Reporter</td><td class="print">Jacob Wieland - Spirent</td><td class="print" colspan="4">&#160;</td></tr><tr class="print"><td class="print-category">Assigned To</td><td class="print">Gyorgy Rethy</td><td class="print" colspan="4">&#160;</td></tr><tr class="print"><td class="print-category">Priority</td><td class="print">high</td><td class="print-category">Severity</td><td class="print">minor</td><td class="print-category">Reproducibility</td><td class="print">have not tried</td></tr><tr class="print"><td class="print-category">Status</td><td class="print">closed</td><td class="print-category">Resolution</td><td class="print">fixed</td><td class="print" colspan="2">&#160;</td></tr><tr class="print"><td class="print-category">Platform</td><td class="print"></td><td class="print-category">OS</td><td class="print"></td><td class="print-category">OS Version</td><td class="print"></td></tr><tr class="print"><td class="print-category">Product Version</td><td class="print"></td><td class="print" colspan="4">&#160;</td></tr><tr><td class="print-category">Target Version</td><td class="print"></td><td class="print-category">Fixed in Version</td><td class="print"></td><td class="print" colspan="2">&#160;</td></tr><tr class="print"><td class="print-category">Clause Reference(s)</td><td class="print" colspan="4">XSD Language Mapping, section 7.1.4</td></tr><tr class="print"><td class="print-category">For STF discussion</td><td class="print" colspan="4"></td></tr><tr class="print"><td class="print-category">Source  (company  - Author)</td><td class="print" colspan="4">Testing Technologies - Jacob Wieland</td></tr><tr><td class="print-spacer" colspan="6"><hr size="1" /></td></tr><tr class="print"><td class="print-category">Summary</td><td class="print" colspan="5">0005852: choice with optional content should be mapped to an optional union field</td></tr><tr class="print"><td class="print-category">Description</td><td class="print" colspan="5">The special case that one element (or sub-particle) of a choice particle can occur 0 times (minOccurs=&quot;0&quot;) should be handled in the way that the resulting union field in the TTCN-3 type should be optional.<br />
<br />
Otherwise, if more than one alternative is 'optional', it is unclear which alternative shall be chosen if none of the elements allowed in the choice are present in the XML.<br />
<br />
Example:<br />
<br />
&lt;choice&gt;<br />
&#160;&#160;&lt;element name=&quot;a&quot; minOccurs=&quot;0&quot; type=&quot;A_Type&quot;/&gt;<br />
&#160;&#160;&lt;element name=&quot;b&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;10&quot; type=&quot;B_Type&quot;/&gt;<br />
&lt;/choice&gt;<br />
<br />
should be mapped to a field like:<br />
<br />
union {<br />
&#160;&#160;A_Type a,<br />
&#160;&#160;record length (1 .. 10) of B_Type b<br />
} choice optional<br />
<br />
Of course, this is true for any sub-particle of a choice which describes the empty XML element concatenation.<br />
<br />
Basically, the rule should be: if one of the sub-fields of a union should be optional in regard to minOccurs or can be the empty list, the union should be optional instead.<br />
<br />
&#160;<br />
&#160;&#160;</td></tr><tr class="print"><td class="print-category">Steps To Reproduce</td><td class="print" colspan="5"></td></tr><tr class="print"><td class="print-category">Additional Information</td><td class="print" colspan="5"></td></tr><tr class="print"><td class="print-category">Tags</td><td class="print" colspan="5">No tags attached.</td></tr><tr class="print"><td class="print-category">Relationships</td><td class="print" colspan="5"></td></tr><tr class="print"><td class="print-category">Attached Files</td><td class="print" colspan="5"><img src="http://oldforge.etsi.org/mantis/images/fileicons/doc.gif" alt="doc" />&#160;CR5852_resolution_v1.doc (157,184) <span class="italic">01-07-2011 10:14</span><br />http://oldforge.etsi.org/mantis/file_download.php?file_id=2543&amp;type=bug<br /><img src="http://oldforge.etsi.org/mantis/images/fileicons/doc.gif" alt="doc" />&#160;CR5852_resolution_v2.doc (75,776) <span class="italic">01-07-2011 16:44</span><br />http://oldforge.etsi.org/mantis/file_download.php?file_id=2553&amp;type=bug</td></tr><tr><td class="print-spacer" colspan="6"><hr size="1" /></td></tr><tr><td class="form-title">Issue History</td></tr><tr class="print-category"><td class="row-category-history">Date Modified</td><td class="row-category-history">Username</td><td class="row-category-history">Field</td><td class="row-category-history">Change</td></tr><tr class="print"><td class="print">22-12-2010 12:27</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=508">Jacob Wieland - Spirent</a></td><td class="print">New Issue</td><td class="print"></td></tr><tr class="print"><td class="print">22-12-2010 12:27</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=508">Jacob Wieland - Spirent</a></td><td class="print">Clause Reference(s)</td><td class="print"> =&gt; XSD Language Mapping, section 7.1.4</td></tr><tr class="print"><td class="print">22-12-2010 12:27</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=508">Jacob Wieland - Spirent</a></td><td class="print">Source  (company  - Author)</td><td class="print"> =&gt; Testing Technologies - Jacob Wieland</td></tr><tr class="print"><td class="print">24-05-2011 15:05</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Note Added: 0010026</td><td class="print"></td></tr><tr class="print"><td class="print">24-05-2011 15:05</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Assigned To</td><td class="print"> =&gt; Gyorgy Rethy</td></tr><tr class="print"><td class="print">24-05-2011 15:05</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Status</td><td class="print">new =&gt; assigned</td></tr><tr class="print"><td class="print">24-05-2011 15:05</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Target Version</td><td class="print"> =&gt; Edition 4.3.2 (interim)</td></tr><tr class="print"><td class="print">24-05-2011 19:22</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Priority</td><td class="print">normal =&gt; high</td></tr><tr class="print"><td class="print">25-05-2011 16:58</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Note Edited: 0010026</td><td class="print"></td></tr><tr class="print"><td class="print">02-06-2011 14:44</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Note Added: 0010112</td><td class="print"></td></tr><tr class="print"><td class="print">02-06-2011 14:52</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Note Edited: 0010112</td><td class="print"></td></tr><tr class="print"><td class="print">02-06-2011 15:16</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Note Edited: 0010112</td><td class="print"></td></tr><tr class="print"><td class="print">02-06-2011 15:40</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Note Edited: 0010112</td><td class="print"></td></tr><tr class="print"><td class="print">06-06-2011 12:04</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=508">Jacob Wieland - Spirent</a></td><td class="print">Note Added: 0010113</td><td class="print"></td></tr><tr class="print"><td class="print">30-06-2011 12:16</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Note Edited: 0010112</td><td class="print"></td></tr><tr class="print"><td class="print">30-06-2011 12:53</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Note Added: 0010156</td><td class="print"></td></tr><tr class="print"><td class="print">30-06-2011 14:39</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Note Added: 0010158</td><td class="print"></td></tr><tr class="print"><td class="print">01-07-2011 10:14</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">File Added: CR5852_resolution_v1.doc</td><td class="print"></td></tr><tr class="print"><td class="print">01-07-2011 10:15</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Note Added: 0010172</td><td class="print"></td></tr><tr class="print"><td class="print">01-07-2011 10:16</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Assigned To</td><td class="print">Gyorgy Rethy =&gt; Ina Schieferdecker</td></tr><tr class="print"><td class="print">01-07-2011 14:03</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Assigned To</td><td class="print">Ina Schieferdecker =&gt; Jacob Wieland - Spirent</td></tr><tr class="print"><td class="print">01-07-2011 16:44</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=508">Jacob Wieland - Spirent</a></td><td class="print">File Added: CR5852_resolution_v2.doc</td><td class="print"></td></tr><tr class="print"><td class="print">01-07-2011 16:44</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=508">Jacob Wieland - Spirent</a></td><td class="print">Note Added: 0010189</td><td class="print"></td></tr><tr class="print"><td class="print">01-07-2011 16:44</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=508">Jacob Wieland - Spirent</a></td><td class="print">Assigned To</td><td class="print">Jacob Wieland - Spirent =&gt; Gyorgy Rethy</td></tr><tr class="print"><td class="print">01-07-2011 16:58</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Status</td><td class="print">assigned =&gt; resolved</td></tr><tr class="print"><td class="print">01-07-2011 16:58</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Resolution</td><td class="print">open =&gt; fixed</td></tr><tr class="print"><td class="print">13-07-2011 16:33</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Status</td><td class="print">resolved =&gt; closed</td></tr><tr class="print"><td class="print">13-07-2011 16:33</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Note Added: 0010219</td><td class="print"></td></tr><tr class="print"><td class="print">13-07-2011 16:33</td><td class="print"><a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a></td><td class="print">Fixed in Version</td><td class="print"> =&gt; Edition 4.3.2 (interim)</td></tr></table>
<br />
<table class="width100" cellspacing="1">
<tr>
	<td class="form-title" colspan="2">
		Notes	</td>
</tr>
<tr>
	<td class="print-spacer" colspan="2">
		<hr size="1" />
	</td>
</tr>
<tr>
	<td class="nopad" valign="top" width="20%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				(0010026)
			</td>
		</tr>
		<tr>
			<td class="print">
				<a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a>&#160;&#160;&#160;
			</td>
		</tr>
		<tr>
			<td class="print">
				24-05-2011 15:05&#160;&#160;&#160;
				<br />(edited on:&#32;25-05-2011 16:58)			</td>
		</tr>
		</table>
	</td>
	<td class="nopad" valign="top" width="85%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				3GPP related CR.<br />
Check the possible solution.<br />
<br />
			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<td class="print-spacer" colspan="2">
		<hr size="1" />
	</td>
</tr>
<tr>
	<td class="nopad" valign="top" width="20%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				(0010112)
			</td>
		</tr>
		<tr>
			<td class="print">
				<a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a>&#160;&#160;&#160;
			</td>
		</tr>
		<tr>
			<td class="print">
				02-06-2011 14:44&#160;&#160;&#160;
				<br />(edited on:&#32;30-06-2011 12:16)			</td>
		</tr>
		</table>
	</td>
	<td class="nopad" valign="top" width="85%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				Yes, this seems to be an unhandled case... though the case when more than one alternative has minOccurs=&quot;0&quot; should be a rather specific one, supposedly used very rarely, as doesn't make much technical sense.<br />
<br />
To understand it better, we have to look at the possible cases when choice can appear:<br />
1) as a complexType on its own<br />
2) as a choice group<br />
===========================================<br />
As compositor of complexTypes, e.g.<br />
&lt;complexType name=&quot;e25choOptional&quot;&gt;<br />
&#160;&#160;&#160;&#160;&lt;choice&gt;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;element name=&quot;title&quot; type=&quot;string&quot; minOccurs=&quot;0&quot;/&gt;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;element name=&quot;forename&quot; type=&quot;string&quot; minOccurs=&quot;0&quot;/&gt;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;element name=&quot;surname&quot; type=&quot;string&quot; minOccurs=&quot;0&quot;/&gt;<br />
&#160;&#160;&#160;&#160;&lt;/choice&gt;<br />
&lt;/complexType&gt;<br />
&lt;element name=&quot;elemChoOptional&quot; type=&quot;ns:e25choOptional&quot;/&gt;<br />
<br />
This could be handled in two ways:<br />
-----------------------------<br />
1.a)<br />
As proposed above:<br />
type record E25choOptional {<br />
&#160;&#160;&#160;&#160;union {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;XSD.String title,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;XSD.String forename,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;XSD.String surname<br />
&#160;&#160;&#160;&#160;} choice optional<br />
}<br />
with {<br />
variant &quot;name as uncapitalized&quot;;<br />
variant (choice) &quot;untagged&quot;;<br />
};<br />
<br />
type E25choOptional ElemChoOptional<br />
with {<br />
variant &quot;name as uncapitalized&quot;;<br />
variant &quot;element&quot;;<br />
};<br />
<br />
template ElemChoOptional t_ElemChoOptional := { choice := omit }<br />
<br />
-----------------------------<br />
1.b) In this case translating minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; to a record of:<br />
type record E25choOptional {<br />
&#160;&#160;&#160;&#160;union {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;record length(0 .. 1) of XSD.String title_list,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;record length(0 .. 1) of XSD.String forename_list,<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;record length(0 .. 1) of XSD.String surname_list<br />
&#160;&#160;&#160;&#160;} choice<br />
}<br />
with {<br />
variant &quot;name as uncapitalized&quot;;<br />
variant (choice) &quot;untagged&quot;;<br />
variant (choice.title_list) &quot;untagged&quot;;<br />
variant (choice.title_list[-]) &quot;name as 'title'&quot;;<br />
variant (choice.forename_list) &quot;untagged&quot;;<br />
variant (choice.forename_list[-]) &quot;name as 'forename'&quot;;<br />
variant (choice.surname_list) &quot;untagged&quot;;<br />
variant (choice.surname_list[-]) &quot;name as 'surname'&quot;;<br />
};<br />
<br />
type E25choOptional ElemChoOptional<br />
with {<br />
variant &quot;name as uncapitalized&quot;;<br />
variant &quot;element&quot;;<br />
};<br />
<br />
template ElemChoOptional t_ElemChoOptional := { choice := {title_list := {}}}<br />
<br />
In this case, of course, there also shall be the same rule as for union-s, the first matching alternative &quot;wins&quot;, thus receiving an empty element would be decoded to:<br />
{ choice := { title_list := { } } }<br />
<br />
Not nice, but can work<br />
<br />
===========================================<br />
Let see these two options also in the case, when choice is used as a governor of groups, embedded in another choice group:<br />
For example:<br />
&lt;group name=&quot;e25ChoGroupOpt&quot;&gt;<br />
&#160;&#160;&#160;&#160;&lt;choice&gt;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;element name=&quot;title&quot; type=&quot;string&quot; minOccurs=&quot;0&quot;/&gt;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;element name=&quot;forename&quot; type=&quot;string&quot; minOccurs=&quot;0&quot;/&gt;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;element name=&quot;surname&quot; type=&quot;string&quot; minOccurs=&quot;0&quot;/&gt;<br />
&#160;&#160;&#160;&#160;&lt;/choice&gt;<br />
&lt;/group&gt;<br />
<br />
&lt;group name=&quot;e25ChoChoGroupOpt&quot;&gt;<br />
&#160;&#160;&#160;&#160;&lt;choice&gt;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;group ref=&quot;ns:e25ChoGroupOpt&quot;/&gt;<br />
&#160;&#160;&#160;&#160;&lt;/choice&gt;<br />
&lt;/group&gt;<br />
<br />
&lt;element name=&quot;elemFromChoGroupOpt&quot;&gt;<br />
&#160;&#160;&#160;&#160;&lt;complexType&gt;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;group ref=&quot;ns:e25ChoChoGroupOpt&quot;/&gt;<br />
&#160;&#160;&#160;&#160;&lt;/complexType&gt;<br />
&lt;/element&gt;<br />
-----------------------------<br />
2.a) translated according to the proposal to:<br />
type union E25ChoGroupOpt {<br />
&#160;&#160;&#160;&#160;XSD.String title,<br />
&#160;&#160;&#160;&#160;XSD.String forename,<br />
&#160;&#160;&#160;&#160;XSD.String surname<br />
}<br />
with {<br />
variant &quot;untagged&quot;;<br />
};<br />
<br />
type union E25ChoChoGroupOpt {<br />
&#160;&#160;&#160;&#160;E25ChoGroupOpt e25ChoGroupOpt<br />
}<br />
with {<br />
variant &quot;untagged&quot;;<br />
};<br />
<br />
type record ElemFromChoGroupOpt {<br />
&#160;&#160;&#160;&#160;E25ChoChoGroupOpt e25ChoChoGroupOpt optional<br />
}<br />
with {<br />
variant &quot;name as uncapitalized&quot;;<br />
variant &quot;element&quot;;<br />
};<br />
<br />
template ElemFromChoGroupOpt t_ElemFromChoGroupOpt := { e25ChoChoGroupOpt := omit }<br />
<br />
-----------------------------<br />
2.b) or with the modified min/maxOccurs conversion to:<br />
type union E25ChoGroupOpt {<br />
&#160;&#160;&#160;&#160;record length(0 .. 1) of XSD.String title_list,<br />
&#160;&#160;&#160;&#160;record length(0 .. 1) of XSD.String forename_list,<br />
&#160;&#160;&#160;&#160;record length(0 .. 1) of XSD.String surname_list<br />
}<br />
with {<br />
variant &quot;untagged&quot;;<br />
variant (choice.title_list) &quot;untagged&quot;;<br />
variant (choice.title_list[-]) &quot;name as 'title'&quot;;<br />
variant (choice.forename_list) &quot;untagged&quot;;<br />
variant (choice.forename_list[-]) &quot;name as 'forename'&quot;;<br />
variant (choice.surname_list) &quot;untagged&quot;;<br />
variant (choice.surname_list[-]) &quot;name as 'surname'&quot;;<br />
};<br />
<br />
type union E25ChoChoGroupOpt {<br />
&#160;&#160;&#160;&#160;E25ChoGroupOpt e25ChoGroupOpt<br />
}<br />
with {<br />
variant &quot;untagged&quot;;<br />
};<br />
<br />
type record ElemChoFromGroupOptional {<br />
&#160;&#160;&#160;&#160;E25ChoChoGroupOpt e25ChoChoGroupOpt<br />
}<br />
with {<br />
variant &quot;name as uncapitalized&quot;;<br />
variant &quot;element&quot;;<br />
};<br />
<br />
template ElemFromChoGroupOptional t_ElemFromChoGroupOptional := {e25ChoChoGroupOpt:= {e25ChoGroupOpt := {title_list :={}}}}<br />
<br />
===========================================<br />
Let see these two options in the case, when the groups is embedded in a sequence group:<br />
&lt;!-- e25ChoGroupOpt as above --&gt;<br />
&lt;group name=&quot;e25SeqChoGroupOpt&quot;&gt;<br />
&#160;&#160;&#160;&#160;&lt;sequence&gt;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;group ref=&quot;ns:e25ChoGroupOpt&quot;/&gt;<br />
&#160;&#160;&#160;&#160;&lt;/sequence&gt;<br />
&lt;/group&gt;<br />
<br />
&lt;element name=&quot;elemFromSeqGroupOpt&quot;&gt;<br />
&#160;&#160;&#160;&#160;&lt;complexType&gt;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;group ref=&quot;ns:e25SeqChoGroupOpt&quot;/&gt;<br />
&#160;&#160;&#160;&#160;&lt;/complexType&gt;<br />
&lt;/element&gt;<br />
-----------------------------<br />
3.a) According to the proposed solution:<br />
type record E25SeqChoGroupOpt {<br />
&#160;&#160;&#160;&#160;E25ChoGroupOpt e25ChoGroupOpt optional<br />
}<br />
with {<br />
variant &quot;untagged&quot;;<br />
};<br />
<br />
type record ElemFromSeqGroupOpt {<br />
&#160;&#160;&#160;&#160;E25SeqChoGroupOpt e25SeqChoGroupOpt<br />
}<br />
with {<br />
variant &quot;name as uncapitalized&quot;;<br />
variant &quot;element&quot;;<br />
};<br />
<br />
template ElemFromSeqGroupOpt t_ElemFromSeqGroupOpt := { e25SeqChoGroupOpt:= {e25ChoGroupOpt:=omit }}<br />
-----------------------------<br />
3.b) or with the modified min/maxOccurs conversion to:<br />
<br />
type record E25SeqChoGroupOpt {<br />
&#160;&#160;&#160;&#160;E25ChoGroupOpt e25ChoGroupOpt<br />
}<br />
with {<br />
variant &quot;untagged&quot;;<br />
};<br />
<br />
type record ElemFromSeqGroupOpt {<br />
&#160;&#160;&#160;&#160;E25SeqChoGroupOpt e25SeqChoGroupOpt<br />
}<br />
with {<br />
variant &quot;name as uncapitalized&quot;;<br />
variant &quot;element&quot;;<br />
};<br />
<br />
template ElemFromSeqGroupOpt t_ElemFromSeqGroupOpt := {e25SeqChoGroupOpt:= {e25ChoGroupOpt := {title_list :={}}}}<br />
===========================================<br />
<br />
So, to sum up the experince from the above trial is:<br />
- if using the proposed solution:<br />
the respective union itself cannot be always made optional but all occurances shall be made optional where the given union is USED in a record the first time. Therefore, for example, no template resulting an empty element can be written for the types E25ChoGroupOpt, E25ChoChoGroupOpt. The values/templates using the type are simpler, but depending on the USE, fields at different levels shall be omitted.<br />
This would be dificult to handle in the standard (changes at more places).<br />
- if using the modified min/maxOccurs mapping:<br />
The minOccurs=&quot;0&quot; is handled directly at the place where it is used. The values/templates are more complex, but consistent in all cases (value has to be discased to the depth of the respective union in all cases, independent of the use of the union.). At matching, this case is more tricky as the user shall remember that in case of an empty element the decoder picks the first alternative. To implement it in the standard, it would need an additional one-two sentence(s) in clause 7.1.4 (&quot;MinOccurs and maxOccurs&quot;), exactly the place where the user would search for the rule.<br />
<br />
Taking into account the findings of the above &quot;experiment&quot;, I propose to handle this case by amending the rules of minOccurs conversion.<br />
<br />
			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<td class="print-spacer" colspan="2">
		<hr size="1" />
	</td>
</tr>
<tr>
	<td class="nopad" valign="top" width="20%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				(0010113)
			</td>
		</tr>
		<tr>
			<td class="print">
				<a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=508">Jacob Wieland - Spirent</a>&#160;&#160;&#160;
			</td>
		</tr>
		<tr>
			<td class="print">
				06-06-2011 12:04&#160;&#160;&#160;
							</td>
		</tr>
		</table>
	</td>
	<td class="nopad" valign="top" width="85%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				Regarding your experiments, I would vote for exactly the other direction. It is much more user-friendly and understandable. We should not opt for the easier way to change the standard just to stick with a user-unfriendly, hard to understand feature. <br />
<br />
Anyone can see from your examples that the mapping of version a) is much more natural and much simpler and, I think, also more composable. <br />
<br />
Since choices pretty much never can stand on their own (they always must be referenced from an element as its type (or be the top-anonymous type of an element or a group reference), it just needs to be stated that whenever such a reference is made to a choice that can evaluate to an emtpy-XML-content, the field referencing the resulting union type must be optional. This can probably also be done with 2 or three well-placed sentences.			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<td class="print-spacer" colspan="2">
		<hr size="1" />
	</td>
</tr>
<tr>
	<td class="nopad" valign="top" width="20%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				(0010156)
			</td>
		</tr>
		<tr>
			<td class="print">
				<a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a>&#160;&#160;&#160;
			</td>
		</tr>
		<tr>
			<td class="print">
				30-06-2011 12:53&#160;&#160;&#160;
							</td>
		</tr>
		</table>
	</td>
	<td class="nopad" valign="top" width="85%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				Choose the record of solution. In case of receiving an empty element the decoder shall also use the first alternative with an empty record of.			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<td class="print-spacer" colspan="2">
		<hr size="1" />
	</td>
</tr>
<tr>
	<td class="nopad" valign="top" width="20%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				(0010158)
			</td>
		</tr>
		<tr>
			<td class="print">
				<a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a>&#160;&#160;&#160;
			</td>
		</tr>
		<tr>
			<td class="print">
				30-06-2011 14:39&#160;&#160;&#160;
							</td>
		</tr>
		</table>
	</td>
	<td class="nopad" valign="top" width="85%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				One more point: when there are more than 1 alternatives with minOccurs=&quot;0&quot; in the XSD choice, only the first one shall be a record length(0..X) of, the rest shall be record length(1..X) of; in this way any decoding ambiguity is removed, an empty something can be received by using the first alternative only.			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<td class="print-spacer" colspan="2">
		<hr size="1" />
	</td>
</tr>
<tr>
	<td class="nopad" valign="top" width="20%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				(0010172)
			</td>
		</tr>
		<tr>
			<td class="print">
				<a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a>&#160;&#160;&#160;
			</td>
		</tr>
		<tr>
			<td class="print">
				01-07-2011 10:15&#160;&#160;&#160;
							</td>
		</tr>
		</table>
	</td>
	<td class="nopad" valign="top" width="85%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				Proposed resolution text is in CR5852_resolution_v1.doc. Pls. review.			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<td class="print-spacer" colspan="2">
		<hr size="1" />
	</td>
</tr>
<tr>
	<td class="nopad" valign="top" width="20%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				(0010189)
			</td>
		</tr>
		<tr>
			<td class="print">
				<a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=508">Jacob Wieland - Spirent</a>&#160;&#160;&#160;
			</td>
		</tr>
		<tr>
			<td class="print">
				01-07-2011 16:44&#160;&#160;&#160;
							</td>
		</tr>
		</table>
	</td>
	<td class="nopad" valign="top" width="85%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				added missing case			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<td class="print-spacer" colspan="2">
		<hr size="1" />
	</td>
</tr>
<tr>
	<td class="nopad" valign="top" width="20%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				(0010219)
			</td>
		</tr>
		<tr>
			<td class="print">
				<a href="http://oldforge.etsi.org/mantis/view_user_page.php?id=127">Gyorgy Rethy</a>&#160;&#160;&#160;
			</td>
		</tr>
		<tr>
			<td class="print">
				13-07-2011 16:33&#160;&#160;&#160;
							</td>
		</tr>
		</table>
	</td>
	<td class="nopad" valign="top" width="85%">
		<table class="hide" cellspacing="1">
		<tr>
			<td class="print">
				Added to master copy.			</td>
		</tr>
		</table>
	</td>
</tr>
</table>
</body>
</html>
