bsloane1650 commented on a change in pull request #207: Added support for
enumerations and TypeValueCalc
URL: https://github.com/apache/incubator-daffodil/pull/207#discussion_r280098684
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/dsom/ChoiceGroup.scala
##########
@@ -139,6 +167,52 @@ abstract class ChoiceTermBase(
ev
}
+ // If choiceDispatchKeyKind is byType, verify that all our children share a
repType,
+ // and use that. Otherwise, there is no need to associate a repType with
this choice
+ override final lazy val optRepTypeFactory: Option[SimpleTypeDefFactory with
NamedMixin] = defaultableChoiceDispatchKeyKind match {
+ case ChoiceKeyKindType.ByType => {
+ val branchReptypes: Seq[SimpleTypeDefFactory with NamedMixin] =
groupMembers.map(term => {
+ term match{
+ case e: ElementDeclMixin => e.typeDef match{
+ case t: SimpleTypeDefBase => t.optRepTypeDefFactory match{
+ case None => SDE("When <xs:choice> has
choiceBranchKey=\"byType\", all branches must have a type which defines a
repType")
+ case Some(x) => x
+ }
+ case _ : SimpleTypeBase => SDE("When <xs:choice> has
choiceBranchKey=\"byType\", no branch can have a primitive xsd type")
+ case _ => SDE("When <xs:choice> has choiceBranchKey=\"byType\",
all branches must be a simple type")
+ }
+ case _ => SDE("When <xs:choice> has choiceBranchKey=\"byType\",
all branches must be a simple element")
Review comment:
You appear to be correct. I added a test with:
```
<xs:choice dfdl:choiceBranchKeyKind="byType"
dfdl:choiceDispatchKeyKind="byType" >
<xs:element ref="tns:one" />
<xs:element ref="tns:two_through_100" />
</xs:choice>
```
Which catches this
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services