Github user mbeckerle commented on a diff in the pull request:

    https://github.com/apache/incubator-daffodil/pull/5#discussion_r150626971
  
    --- Diff: 
daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/dsom/ChoiceGroup.scala 
---
    @@ -78,29 +77,48 @@ import edu.illinois.ncsa.daffodil.api.WarnID
      *
      */
     
    -final class Choice(xmlArg: Node, parent: SchemaComponent, position: Int)
    -  extends ModelGroup(xmlArg, parent, position)
    -  with Choice_AnnotationMixin
    -  with RawDelimitedRuntimeValuedPropertiesMixin // initiator and 
terminator (not separator)
    -  with ChoiceGrammarMixin {
    +trait ChoiceLikeMixin
    +  extends AnnotatedSchemaComponent
    +  with DFDLStatementMixin {
     
    -  requiredEvaluations(branchesAreNonOptional)
    -  requiredEvaluations(branchesAreNotIVCElements)
    -  requiredEvaluations(modelGroupRuntimeData.preSerialization)
    +  protected def isMyFormatAnnotation(a: DFDLAnnotation) = 
a.isInstanceOf[DFDLChoice]
     
    -  protected final override lazy val myPeers = choicePeers
    -
    -  protected final override def annotationFactory(node: Node): 
Option[DFDLAnnotation] = {
    +  protected override def annotationFactory(node: Node): 
Option[DFDLAnnotation] = {
         node match {
           case <dfdl:choice>{ contents @ _* }</dfdl:choice> => Some(new 
DFDLChoice(node, this))
           case _ => annotationFactoryForDFDLStatement(node, this)
         }
       }
     
    -  protected final def emptyFormatFactory = new 
DFDLChoice(newDFDLAnnotationXML("choice"), this)
    -  protected final def isMyFormatAnnotation(a: DFDLAnnotation) = 
a.isInstanceOf[DFDLChoice]
    +  protected def emptyFormatFactory: DFDLFormatAnnotation = new 
DFDLChoice(newDFDLAnnotationXML("choice"), this)
    +
    +  lazy val xmlChildren = xml match {
    +    case <choice>{ c @ _* }</choice> => c
    +    case <group>{ _* }</group> => {
    +      val ch = this match {
    +        case cgr: ChoiceGroupRef => cgr.groupDef.xml \\ "choice"
    +        case cgd: GlobalChoiceGroupDef => cgd.xml \\ "choice"
    +      }
    +      val <choice>{ c @ _* }</choice> = ch(0)
    +      c
    +    }
    +  }
    +}
    +
    +abstract class ChoiceBase( final override val xml: Node,
    +  final override val parent: SchemaComponent,
    +  final override val position: Int)
    +  extends ModelGroup
    +  with ChoiceLikeMixin
    --- End diff --
    
    Should not be mixed into ChoiceBase. Will change code. 


---

Reply via email to