You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by mb...@apache.org on 2017/11/17 16:12:12 UTC

[3/6] incubator-daffodil git commit: Property Resolution - part of fixing schema compilation

http://git-wip-us.apache.org/repos/asf/incubator-daffodil/blob/89517717/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/primitives/RepPrims.scala
----------------------------------------------------------------------
diff --git a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/primitives/RepPrims.scala b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/primitives/RepPrims.scala
index fd45a1f..0e2a355 100644
--- a/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/primitives/RepPrims.scala
+++ b/daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/primitives/RepPrims.scala
@@ -57,7 +57,7 @@ object INoWarn6 { ImplicitsSuppressUnusedImportWarning() }
 object ENoWarn6 { EqualitySuppressUnusedImportWarning() }
 
 object RepPrims {
-  abstract class RepPrim(context: LocalElementBase, n: Long, r: => Gram)
+  abstract class RepPrim(context: ElementBase, n: Long, r: => Gram)
     extends UnaryGram(context, r) {
     Assert.invariant(n > 0)
     lazy val rd = context.elementRuntimeData
@@ -67,23 +67,23 @@ object RepPrims {
 
   }
 
-  abstract class Rep3Arg(f: (LocalElementBase, Long, => Gram) => Gram) {
-    def apply(context: LocalElementBase, n: Long, rr: => Gram) = {
+  abstract class Rep3Arg(f: (ElementBase, Long, => Gram) => Gram) {
+    def apply(context: ElementBase, n: Long, rr: => Gram) = {
       lazy val r = rr
       if (n == 0 || r.isEmpty) EmptyGram
       else f(context, n, r)
     }
   }
 
-  abstract class Rep2Arg(f: (LocalElementBase, => Gram) => Gram) {
-    def apply(context: LocalElementBase, r: => Gram) = {
+  abstract class Rep2Arg(f: (ElementBase, => Gram) => Gram) {
+    def apply(context: ElementBase, r: => Gram) = {
       lazy val rr = r
       if (rr.isEmpty) EmptyGram
       else f(context, r)
     }
   }
 
-  class RepExactlyNPrim(context: LocalElementBase, n: Long, r: => Gram) extends RepPrim(context, n, r) {
+  class RepExactlyNPrim(context: ElementBase, n: Long, r: => Gram) extends RepPrim(context, n, r) {
 
     // Since this is Exactly N, there is no new point of uncertainty considerations here.
     override lazy val parser = new RepExactlyNParser(n, r.parser, context.elementRuntimeData)
@@ -91,27 +91,27 @@ object RepPrims {
 
   }
 
-  class RepAtMostTotalNPrim(context: LocalElementBase, n: Long, r: => Gram) extends RepPrim(context, n, r) {
+  class RepAtMostTotalNPrim(context: ElementBase, n: Long, r: => Gram) extends RepPrim(context, n, r) {
 
     override lazy val parser = new RepAtMostTotalNParser(n, r.parser, context.elementRuntimeData)
     override lazy val unparser = new RepAtMostTotalNUnparser(n, r.unparser, context.elementRuntimeData)
 
   }
 
-  class RepExactlyTotalNPrim(context: LocalElementBase, n: Long, r: => Gram) extends RepPrim(context, n, r) {
+  class RepExactlyTotalNPrim(context: ElementBase, n: Long, r: => Gram) extends RepPrim(context, n, r) {
 
     override lazy val parser = new RepExactlyTotalNParser(n, r.parser, context.elementRuntimeData)
     override lazy val unparser = new RepExactlyTotalNUnparser(n, r.unparser, context.elementRuntimeData)
 
   }
 
-  class RepUnboundedPrim(e: LocalElementBase, r: => Gram) extends RepPrim(e, 1, r) {
+  class RepUnboundedPrim(e: ElementBase, r: => Gram) extends RepPrim(e, 1, r) {
 
     override lazy val parser = new RepUnboundedParser(e.occursCountKind, r.parser, e.elementRuntimeData)
     override lazy val unparser = new RepUnboundedUnparser(e.occursCountKind, r.unparser, e.elementRuntimeData)
   }
 
-  class RepAtMostOccursCountPrim(e: LocalElementBase, n: Long, r: => Gram)
+  class RepAtMostOccursCountPrim(e: ElementBase, n: Long, r: => Gram)
     extends RepPrim(e, n, r) {
 
     override lazy val parser = new RepAtMostOccursCountParser(r.parser, n, e.elementRuntimeData)
@@ -119,7 +119,7 @@ object RepPrims {
 
   }
 
-  class RepExactlyTotalOccursCountPrim(e: LocalElementBase, r: => Gram)
+  class RepExactlyTotalOccursCountPrim(e: ElementBase, r: => Gram)
     extends RepPrim(e, 1, r) {
 
     override lazy val parser = new RepExactlyTotalOccursCountParser(r.parser, e.elementRuntimeData)

http://git-wip-us.apache.org/repos/asf/incubator-daffodil/blob/89517717/daffodil-core/src/test/resources/test/example-of-most-dfdl-constructs.dfdl.xml
----------------------------------------------------------------------
diff --git a/daffodil-core/src/test/resources/test/example-of-most-dfdl-constructs.dfdl.xml b/daffodil-core/src/test/resources/test/example-of-most-dfdl-constructs.dfdl.xml
index b9d57d4..1d66b68 100644
--- a/daffodil-core/src/test/resources/test/example-of-most-dfdl-constructs.dfdl.xml
+++ b/daffodil-core/src/test/resources/test/example-of-most-dfdl-constructs.dfdl.xml
@@ -8,6 +8,8 @@
   xsi:schemaLocation="http://www.ogf.org/dfdl/dfdl-1.0/ xsd/DFDL_part3_model.xsd 
   http://www.w3.org/2001/XMLSchema xsd/XMLSchema_for_DFDL.xsd">
 
+  <xs:include schemaLocation="edu/illinois/ncsa/daffodil/xsd/built-in-formats.xsd"/>
+
   <annotation>
     <documentation>
       The goal of this schema is to make one use of every XSD
@@ -79,7 +81,8 @@
       <!-- note use of Japanese Kanji in the name -->
       <dfdl:defineFormat name="def2年月日">
         <dfdl:format representation="binary"
-          textStandardBase="10" escapeSchemeRef="tns:quotingScheme" sequenceKind="ordered" />
+          textStandardBase="10" escapeSchemeRef="tns:quotingScheme" sequenceKind="ordered"
+          ref="ex:daffodilTest1" />
       </dfdl:defineFormat>
       <dfdl:defineEscapeScheme name="quotingScheme">
         <dfdl:escapeScheme escapeCharacter="%%"

http://git-wip-us.apache.org/repos/asf/incubator-daffodil/blob/89517717/daffodil-core/src/test/scala-debug/edu/illinois/ncsa/daffodil/dsom/TestDsomCompilerNew.scala
----------------------------------------------------------------------
diff --git a/daffodil-core/src/test/scala-debug/edu/illinois/ncsa/daffodil/dsom/TestDsomCompilerNew.scala b/daffodil-core/src/test/scala-debug/edu/illinois/ncsa/daffodil/dsom/TestDsomCompilerNew.scala
index e4dc979..cb4efaf 100644
--- a/daffodil-core/src/test/scala-debug/edu/illinois/ncsa/daffodil/dsom/TestDsomCompilerNew.scala
+++ b/daffodil-core/src/test/scala-debug/edu/illinois/ncsa/daffodil/dsom/TestDsomCompilerNew.scala
@@ -191,22 +191,22 @@ class TestDsomCompilerNew extends Logging {
     val elemsFollowingRootSeq = rootCTSeq.possibleNextTerms
     assertEquals(0, elemsFollowingRootSeq.length)
 
-    val Seq(one: LocalElementBase, two: LocalElementBase, three: LocalElementBase, _: Sequence) =
+    val Seq(one: ElementBase, two: ElementBase, three: ElementBase, _: Sequence) =
       rootCTSeq.groupMembers // has an element and a sub-sequence as its children.
 
     val elemsFollowingOne = one.possibleNextTerms
     assertEquals(1, elemsFollowingOne.length)
-    assertEquals("two", elemsFollowingOne(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("two", elemsFollowingOne(0).asInstanceOf[ElementBase].name)
 
     val elemsFollowingTwo = two.possibleNextTerms
     assertEquals(1, elemsFollowingTwo.length)
-    assertEquals("three", elemsFollowingTwo(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("three", elemsFollowingTwo(0).asInstanceOf[ElementBase].name)
 
     val elemsFollowingThree = three.possibleNextTerms
     assertEquals(1, elemsFollowingThree.length)
     val seqFollowingThree = elemsFollowingThree(0).asInstanceOf[Sequence]
 
-    val Seq(four: LocalElementBase) = seqFollowingThree.allSelfContainedTermsTerminatedByRequiredElement
+    val Seq(four: ElementBase) = seqFollowingThree.allSelfContainedTermsTerminatedByRequiredElement
     assertEquals("four", four.name)
 
   }
@@ -282,24 +282,24 @@ class TestDsomCompilerNew extends Logging {
     val elemsFollowingRootSeq = rootCTSeq.possibleNextTerms
     assertEquals(0, elemsFollowingRootSeq.length)
 
-    val Seq(one: LocalElementBase, two: LocalElementBase, three: LocalElementBase, _: Sequence) =
+    val Seq(one: ElementBase, two: ElementBase, three: ElementBase, _: Sequence) =
       rootCTSeq.groupMembers // has an element and a sub-sequence as its children.
 
     val elemsFollowingOne = one.possibleNextTerms
     assertEquals(1, elemsFollowingOne.length)
-    assertEquals("two", elemsFollowingOne(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("two", elemsFollowingOne(0).asInstanceOf[ElementBase].name)
 
     val elemsFollowingTwo = two.possibleNextTerms
     assertEquals(2, elemsFollowingTwo.length)
-    assertEquals("three", elemsFollowingTwo(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("three", elemsFollowingTwo(0).asInstanceOf[ElementBase].name)
     val seqFollowingThree = elemsFollowingTwo(1).asInstanceOf[Sequence]
-    val Seq(four: LocalElementBase) = seqFollowingThree.groupMembers
+    val Seq(four: ElementBase) = seqFollowingThree.groupMembers
     assertEquals("four", four.name)
 
     val elemsFollowingThree = three.possibleNextTerms
     assertEquals(1, elemsFollowingThree.length)
     val seqFollowingThree2 = elemsFollowingThree(0).asInstanceOf[Sequence]
-    val Seq(four2: LocalElementBase) = seqFollowingThree2.groupMembers
+    val Seq(four2: ElementBase) = seqFollowingThree2.groupMembers
     assertEquals("four", four2.name)
   }
 
@@ -373,22 +373,22 @@ class TestDsomCompilerNew extends Logging {
     val elemsFollowingRootSeq = rootCTSeq.possibleNextTerms
     assertEquals(0, elemsFollowingRootSeq.length)
 
-    val Seq(one: LocalElementBase, two: LocalElementBase, three: LocalElementBase, _: Sequence) =
+    val Seq(one: ElementBase, two: ElementBase, three: ElementBase, _: Sequence) =
       rootCTSeq.groupMembers // has an element and a sub-sequence as its children.
 
     val elemsFollowingOne = one.possibleNextTerms
     assertEquals(2, elemsFollowingOne.length)
-    assertEquals("two", elemsFollowingOne(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("three", elemsFollowingOne(1).asInstanceOf[LocalElementBase].name)
+    assertEquals("two", elemsFollowingOne(0).asInstanceOf[ElementBase].name)
+    assertEquals("three", elemsFollowingOne(1).asInstanceOf[ElementBase].name)
 
     val elemsFollowingTwo = two.possibleNextTerms
     assertEquals(1, elemsFollowingTwo.length)
-    assertEquals("three", elemsFollowingTwo(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("three", elemsFollowingTwo(0).asInstanceOf[ElementBase].name)
 
     val elemsFollowingThree = three.possibleNextTerms
     assertEquals(1, elemsFollowingThree.length)
     val seqFollowingThree = elemsFollowingThree(0).asInstanceOf[Sequence]
-    val Seq(four: LocalElementBase) = seqFollowingThree.groupMembers
+    val Seq(four: ElementBase) = seqFollowingThree.groupMembers
     assertEquals("four", four.name)
 
   }
@@ -463,21 +463,21 @@ class TestDsomCompilerNew extends Logging {
     val elemsFollowingRootSeq = rootCTSeq.possibleNextTerms
     assertEquals(0, elemsFollowingRootSeq.length)
 
-    val Seq(one: LocalElementBase, two: LocalElementBase, three: LocalElementBase, _: Sequence) =
+    val Seq(one: ElementBase, two: ElementBase, three: ElementBase, _: Sequence) =
       rootCTSeq.groupMembers // has an element and a sub-sequence as its children.
 
     val elemsFollowingOne = one.possibleNextTerms
     assertEquals(1, elemsFollowingOne.length)
-    assertEquals("two", elemsFollowingOne(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("two", elemsFollowingOne(0).asInstanceOf[ElementBase].name)
 
     val elemsFollowingTwo = two.possibleNextTerms
     assertEquals(1, elemsFollowingTwo.length)
-    assertEquals("three", elemsFollowingTwo(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("three", elemsFollowingTwo(0).asInstanceOf[ElementBase].name)
 
     val elemsFollowingThree = three.possibleNextTerms
     assertEquals(1, elemsFollowingThree.length)
     val seqFollowingThree = elemsFollowingThree(0).asInstanceOf[Sequence]
-    val Seq(four: LocalElementBase) = seqFollowingThree.groupMembers
+    val Seq(four: ElementBase) = seqFollowingThree.groupMembers
     assertEquals("four", four.name)
 
   }
@@ -558,30 +558,30 @@ class TestDsomCompilerNew extends Logging {
     val elemsFollowingRootSeq = rootCTSeq.possibleNextTerms
     assertEquals(0, elemsFollowingRootSeq.length)
 
-    val Seq(one: LocalElementBase, two: LocalElementBase, three: LocalElementBase, seq: Sequence) =
+    val Seq(one: ElementBase, two: ElementBase, three: ElementBase, seq: Sequence) =
       rootCTSeq.groupMembers // has an element and a sub-sequence as its children.
 
-    val Seq(four: LocalElementBase) = seq.groupMembers
+    val Seq(four: ElementBase) = seq.groupMembers
 
     val elemsFollowingOne = one.possibleNextTerms
-    val Seq(eTwo: LocalElementBase, eThree: LocalElementBase, seqFollowingThree: Sequence) = one.possibleNextTerms
+    val Seq(eTwo: ElementBase, eThree: ElementBase, seqFollowingThree: Sequence) = one.possibleNextTerms
     assertEquals(3, elemsFollowingOne.length)
     assertEquals("two", eTwo.name)
     assertEquals("three", eThree.name)
-    val Seq(eFour: LocalElementBase) = seqFollowingThree.groupMembers
+    val Seq(eFour: ElementBase) = seqFollowingThree.groupMembers
     assertEquals("four", eFour.name)
 
     val elemsFollowingTwo = two.possibleNextTerms
-    val Seq(eThree_2: LocalElementBase, seqFollowingThree_2: Sequence) = two.possibleNextTerms
+    val Seq(eThree_2: ElementBase, seqFollowingThree_2: Sequence) = two.possibleNextTerms
     assertEquals(2, elemsFollowingTwo.length)
     assertEquals("three", eThree_2.name)
-    val Seq(eFour_2: LocalElementBase) = seqFollowingThree_2.groupMembers
+    val Seq(eFour_2: ElementBase) = seqFollowingThree_2.groupMembers
     assertEquals("four", eFour_2.name)
 
     val elemsFollowingThree = three.possibleNextTerms
     val Seq(seqFollowingThree_3: Sequence) = three.possibleNextTerms
     assertEquals(1, elemsFollowingThree.length)
-    val Seq(eFour_3: LocalElementBase) = seqFollowingThree_3.groupMembers
+    val Seq(eFour_3: ElementBase) = seqFollowingThree_3.groupMembers
     assertEquals("four", eFour_3.name)
 
     val elemsFollowingFour = four.possibleNextTerms
@@ -665,29 +665,29 @@ class TestDsomCompilerNew extends Logging {
     val elemsFollowingRootSeq = rootCTSeq.possibleNextTerms
     assertEquals(0, elemsFollowingRootSeq.length)
 
-    val Seq(one: LocalElementBase, two: LocalElementBase, three: LocalElementBase, seq: Sequence) =
+    val Seq(one: ElementBase, two: ElementBase, three: ElementBase, seq: Sequence) =
       rootCTSeq.groupMembers // has an element and a sub-sequence as its children.
 
-    val Seq(four: LocalElementBase) = seq.groupMembers
+    val Seq(four: ElementBase) = seq.groupMembers
 
     val elemsFollowingOne = one.possibleNextTerms
-    val Seq(two_1: LocalElementBase, three_1: LocalElementBase, seqFollowingThree_1: Sequence) = one.possibleNextTerms
-    val Seq(four_1: LocalElementBase) = seqFollowingThree_1.groupMembers
+    val Seq(two_1: ElementBase, three_1: ElementBase, seqFollowingThree_1: Sequence) = one.possibleNextTerms
+    val Seq(four_1: ElementBase) = seqFollowingThree_1.groupMembers
     assertEquals(3, elemsFollowingOne.length)
     assertEquals("two", two_1.name)
     assertEquals("three", three_1.name)
     assertEquals("four", four_1.name)
 
     val elemsFollowingTwo = two.possibleNextTerms
-    val Seq(three_2: LocalElementBase, seqFollowingThree_2: Sequence) = two.possibleNextTerms
-    val Seq(four_2: LocalElementBase) = seqFollowingThree_2.groupMembers
+    val Seq(three_2: ElementBase, seqFollowingThree_2: Sequence) = two.possibleNextTerms
+    val Seq(four_2: ElementBase) = seqFollowingThree_2.groupMembers
     assertEquals(2, elemsFollowingTwo.length)
     assertEquals("three", three_2.name)
     assertEquals("four", four_2.name)
 
     val elemsFollowingThree = three.possibleNextTerms
     val Seq(seqFollowingThree_3: Sequence) = three.possibleNextTerms
-    val Seq(four_3: LocalElementBase) = seqFollowingThree_3.groupMembers
+    val Seq(four_3: ElementBase) = seqFollowingThree_3.groupMembers
     assertEquals(1, elemsFollowingThree.length)
     assertEquals("four", four_3.name)
 
@@ -784,8 +784,8 @@ class TestDsomCompilerNew extends Logging {
     val oneCTSeq = oneCT.sequence
     val elemsFollowingOneCTSeq = oneCTSeq.possibleNextTerms
 
-    val Seq(two_1: LocalElementBase, three_1: LocalElementBase, seqFollowingThree_1: Sequence) = oneCTSeq.possibleNextTerms
-    val Seq(four_1: LocalElementBase) = seqFollowingThree_1.groupMembers
+    val Seq(two_1: ElementBase, three_1: ElementBase, seqFollowingThree_1: Sequence) = oneCTSeq.possibleNextTerms
+    val Seq(four_1: ElementBase) = seqFollowingThree_1.groupMembers
     assertEquals(3, elemsFollowingOneCTSeq.length)
     assertEquals("two", two_1.name)
     assertEquals("three", three_1.name)
@@ -795,30 +795,30 @@ class TestDsomCompilerNew extends Logging {
 
     val elemsFollowingA = a.possibleNextTerms
     assertEquals(1, elemsFollowingA.length)
-    assertEquals("b", elemsFollowingA(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("b", elemsFollowingA(0).asInstanceOf[ElementBase].name)
 
     val elemsFollowingB = b.possibleNextTerms
     assertEquals(1, elemsFollowingB.length)
-    assertEquals("c", elemsFollowingB(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("c", elemsFollowingB(0).asInstanceOf[ElementBase].name)
 
     val elemsFollowingC = c.possibleNextTerms
-    val Seq(two_2: LocalElementBase, three_2: LocalElementBase, seqFollowingThree_2: Sequence) = c.possibleNextTerms
-    val Seq(four_2: LocalElementBase) = seqFollowingThree_2.groupMembers
+    val Seq(two_2: ElementBase, three_2: ElementBase, seqFollowingThree_2: Sequence) = c.possibleNextTerms
+    val Seq(four_2: ElementBase) = seqFollowingThree_2.groupMembers
     assertEquals(3, elemsFollowingC.length)
     assertEquals("two", two_2.name)
     assertEquals("three", three_2.name)
     assertEquals("four", four_2.name)
 
     val elemsFollowingTwo = two.possibleNextTerms
-    val Seq(three_3: LocalElementBase, seqFollowingThree_3: Sequence) = two.possibleNextTerms
-    val Seq(four_3: LocalElementBase) = seqFollowingThree_3.groupMembers
+    val Seq(three_3: ElementBase, seqFollowingThree_3: Sequence) = two.possibleNextTerms
+    val Seq(four_3: ElementBase) = seqFollowingThree_3.groupMembers
     assertEquals(2, elemsFollowingTwo.length)
     assertEquals("three", three_3.name)
     assertEquals("four", four_3.name)
 
     val elemsFollowingThree = three.possibleNextTerms
     val Seq(seqFollowingThree_4: Sequence) = three.possibleNextTerms
-    val Seq(four_4: LocalElementBase) = seqFollowingThree_4.groupMembers
+    val Seq(four_4: ElementBase) = seqFollowingThree_4.groupMembers
     assertEquals(1, elemsFollowingThree.length)
     assertEquals("four", four_4.name)
 
@@ -923,8 +923,8 @@ class TestDsomCompilerNew extends Logging {
     val oneCTSeq = oneCT.sequence
     val elemsFollowingOneCTSeq = oneCTSeq.possibleNextTerms
 
-    val Seq(two_1: LocalElementBase, three_1: LocalElementBase, seqFollowingThree_1: Sequence) = oneCTSeq.possibleNextTerms
-    val Seq(four_1: LocalElementBase) = seqFollowingThree_1.groupMembers
+    val Seq(two_1: ElementBase, three_1: ElementBase, seqFollowingThree_1: Sequence) = oneCTSeq.possibleNextTerms
+    val Seq(four_1: ElementBase) = seqFollowingThree_1.groupMembers
     assertEquals(3, elemsFollowingOneCTSeq.length)
     assertEquals("two", two_1.name)
     assertEquals("three", three_1.name)
@@ -933,8 +933,8 @@ class TestDsomCompilerNew extends Logging {
     val Seq(a: LocalElementDecl, b: LocalElementDecl, c: LocalElementDecl, _: Sequence) = oneCTSeq.groupMembers
 
     val elemsFollowingA = a.possibleNextTerms
-    val Seq(b_1: LocalElementBase, c_1: LocalElementBase, seqFollowingC_1: Sequence) = a.possibleNextTerms
-    val Seq(s1_1: LocalElementBase, s2_1: LocalElementBase, s3_1: LocalElementBase) = seqFollowingC_1.groupMembers
+    val Seq(b_1: ElementBase, c_1: ElementBase, seqFollowingC_1: Sequence) = a.possibleNextTerms
+    val Seq(s1_1: ElementBase, s2_1: ElementBase, s3_1: ElementBase) = seqFollowingC_1.groupMembers
     assertEquals(3, elemsFollowingA.length)
     assertEquals("b", b_1.name)
     assertEquals("c", c_1.name)
@@ -943,8 +943,8 @@ class TestDsomCompilerNew extends Logging {
     assertEquals("s-3", s3_1.name)
 
     val elemsFollowingB = b.possibleNextTerms
-    val Seq(c_2: LocalElementBase, seqFollowingC_2: Sequence) = b.possibleNextTerms
-    val Seq(s1_2: LocalElementBase, s2_2: LocalElementBase, s3_2: LocalElementBase) = seqFollowingC_2.groupMembers
+    val Seq(c_2: ElementBase, seqFollowingC_2: Sequence) = b.possibleNextTerms
+    val Seq(s1_2: ElementBase, s2_2: ElementBase, s3_2: ElementBase) = seqFollowingC_2.groupMembers
     assertEquals(2, elemsFollowingB.length)
     assertEquals("c", c_2.name)
     assertEquals("s-1", s1_2.name)
@@ -953,22 +953,22 @@ class TestDsomCompilerNew extends Logging {
 
     val elemsFollowingC = c.possibleNextTerms
     val Seq(seqFollowingC_3: Sequence) = c.possibleNextTerms
-    val Seq(s1_3: LocalElementBase, s2_3: LocalElementBase, s3_3: LocalElementBase) = seqFollowingC_3.groupMembers
+    val Seq(s1_3: ElementBase, s2_3: ElementBase, s3_3: ElementBase) = seqFollowingC_3.groupMembers
     assertEquals(1, elemsFollowingC.length)
     assertEquals("s-1", s1_3.name)
     assertEquals("s-2", s2_3.name)
     assertEquals("s-3", s3_3.name)
 
     val elemsFollowingTwo = two.possibleNextTerms
-    val Seq(three_2: LocalElementBase, seqFollowingThree_2: Sequence) = two.possibleNextTerms
-    val Seq(four_2: LocalElementBase) = seqFollowingThree_2.groupMembers
+    val Seq(three_2: ElementBase, seqFollowingThree_2: Sequence) = two.possibleNextTerms
+    val Seq(four_2: ElementBase) = seqFollowingThree_2.groupMembers
     assertEquals(2, elemsFollowingTwo.length)
     assertEquals("three", three_2.name)
     assertEquals("four", four_2.name)
 
     val elemsFollowingThree = three.possibleNextTerms
     val Seq(seqFollowingThree_3: Sequence) = three.possibleNextTerms
-    val Seq(four_3: LocalElementBase) = seqFollowingThree_3.groupMembers
+    val Seq(four_3: ElementBase) = seqFollowingThree_3.groupMembers
     assertEquals(1, elemsFollowingThree.length)
     assertEquals("four", four_3.name)
 
@@ -1073,8 +1073,8 @@ class TestDsomCompilerNew extends Logging {
     val oneCTSeq = oneCT.sequence
     val elemsFollowingOneCTSeq = oneCTSeq.possibleNextTerms
 
-    val Seq(two_1: LocalElementBase, three_1: LocalElementBase, seqFollowingThree_1: Sequence) = oneCTSeq.possibleNextTerms
-    val Seq(four_1: LocalElementBase) = seqFollowingThree_1.groupMembers
+    val Seq(two_1: ElementBase, three_1: ElementBase, seqFollowingThree_1: Sequence) = oneCTSeq.possibleNextTerms
+    val Seq(four_1: ElementBase) = seqFollowingThree_1.groupMembers
     assertEquals(3, elemsFollowingOneCTSeq.length)
     assertEquals("two", two_1.name)
     assertEquals("three", three_1.name)
@@ -1083,8 +1083,8 @@ class TestDsomCompilerNew extends Logging {
     val Seq(a: LocalElementDecl, b: LocalElementDecl, _: Sequence, c: LocalElementDecl) = oneCTSeq.groupMembers
 
     val elemsFollowingA = a.possibleNextTerms
-    val Seq(b_1: LocalElementBase, seqFollowingA: Sequence) = a.possibleNextTerms
-    val Seq(s1_1: LocalElementBase, s2_1: LocalElementBase, s3_1: LocalElementBase) = seqFollowingA.groupMembers
+    val Seq(b_1: ElementBase, seqFollowingA: Sequence) = a.possibleNextTerms
+    val Seq(s1_1: ElementBase, s2_1: ElementBase, s3_1: ElementBase) = seqFollowingA.groupMembers
     assertEquals(2, elemsFollowingA.length)
     assertEquals("b", b_1.name)
     assertEquals("s-1", s1_1.name)
@@ -1093,30 +1093,30 @@ class TestDsomCompilerNew extends Logging {
 
     val elemsFollowingB = b.possibleNextTerms
     val Seq(seqFollowingB: Sequence) = b.possibleNextTerms
-    val Seq(s1_2: LocalElementBase, s2_2: LocalElementBase, s3_2: LocalElementBase) = seqFollowingB.groupMembers
+    val Seq(s1_2: ElementBase, s2_2: ElementBase, s3_2: ElementBase) = seqFollowingB.groupMembers
     assertEquals(1, elemsFollowingB.length)
     assertEquals("s-1", s1_2.name)
     assertEquals("s-2", s2_2.name)
     assertEquals("s-3", s3_2.name)
 
     val elemsFollowingC = c.possibleNextTerms
-    val Seq(two_2: LocalElementBase, three_2: LocalElementBase, seqFollowingThree_2: Sequence) = c.possibleNextTerms
-    val Seq(four_2: LocalElementBase) = seqFollowingThree_2.groupMembers
+    val Seq(two_2: ElementBase, three_2: ElementBase, seqFollowingThree_2: Sequence) = c.possibleNextTerms
+    val Seq(four_2: ElementBase) = seqFollowingThree_2.groupMembers
     assertEquals(3, elemsFollowingC.length)
     assertEquals("two", two_2.name)
     assertEquals("three", three_2.name)
     assertEquals("four", four_2.name)
 
     val elemsFollowingTwo = two.possibleNextTerms
-    val Seq(three_3: LocalElementBase, seqFollowingThree_3: Sequence) = two.possibleNextTerms
-    val Seq(four_3: LocalElementBase) = seqFollowingThree_3.groupMembers
+    val Seq(three_3: ElementBase, seqFollowingThree_3: Sequence) = two.possibleNextTerms
+    val Seq(four_3: ElementBase) = seqFollowingThree_3.groupMembers
     assertEquals(2, elemsFollowingTwo.length)
     assertEquals("three", three_3.name)
     assertEquals("four", four_3.name)
 
     val elemsFollowingThree = three.possibleNextTerms
     val Seq(seqFollowingThree_4: Sequence) = three.possibleNextTerms
-    val Seq(four_4: LocalElementBase) = seqFollowingThree_4.groupMembers
+    val Seq(four_4: ElementBase) = seqFollowingThree_4.groupMembers
     assertEquals(1, elemsFollowingThree.length)
     assertEquals("four", four_4.name)
 
@@ -1221,8 +1221,8 @@ class TestDsomCompilerNew extends Logging {
     val oneCTSeq = oneCT.sequence
     val elemsFollowingOneCTSeq = oneCTSeq.possibleNextTerms
 
-    val Seq(two_1: LocalElementBase, three_1: LocalElementBase, seqFollowingThree_1: Sequence) = oneCTSeq.possibleNextTerms
-    val Seq(four_1: LocalElementBase) = seqFollowingThree_1.groupMembers
+    val Seq(two_1: ElementBase, three_1: ElementBase, seqFollowingThree_1: Sequence) = oneCTSeq.possibleNextTerms
+    val Seq(four_1: ElementBase) = seqFollowingThree_1.groupMembers
     assertEquals(3, elemsFollowingOneCTSeq.length)
     assertEquals("two", two_1.name)
     assertEquals("three", three_1.name)
@@ -1231,8 +1231,8 @@ class TestDsomCompilerNew extends Logging {
     val Seq(_: Sequence, a: LocalElementDecl, b: LocalElementDecl, c: LocalElementDecl) = oneCTSeq.groupMembers
 
     val elemsFollowingA = a.possibleNextTerms
-    val Seq(b_2: LocalElementBase, c_2: LocalElementBase, two_2: LocalElementBase, three_2: LocalElementBase, seqFollowingThree_2: Sequence) = a.possibleNextTerms
-    val Seq(four_2: LocalElementBase) = seqFollowingThree_2.groupMembers
+    val Seq(b_2: ElementBase, c_2: ElementBase, two_2: ElementBase, three_2: ElementBase, seqFollowingThree_2: Sequence) = a.possibleNextTerms
+    val Seq(four_2: ElementBase) = seqFollowingThree_2.groupMembers
     assertEquals(5, elemsFollowingA.length)
     assertEquals("b", b_2.name)
     assertEquals("c", c_2.name)
@@ -1241,8 +1241,8 @@ class TestDsomCompilerNew extends Logging {
     assertEquals("four", four_2.name)
 
     val elemsFollowingB = b.possibleNextTerms
-    val Seq(c_3: LocalElementBase, two_3: LocalElementBase, three_3: LocalElementBase, seqFollowingThree_3: Sequence) = b.possibleNextTerms
-    val Seq(four_3: LocalElementBase) = seqFollowingThree_3.groupMembers
+    val Seq(c_3: ElementBase, two_3: ElementBase, three_3: ElementBase, seqFollowingThree_3: Sequence) = b.possibleNextTerms
+    val Seq(four_3: ElementBase) = seqFollowingThree_3.groupMembers
     assertEquals(4, elemsFollowingB.length)
     assertEquals("c", c_3.name)
     assertEquals("two", two_3.name)
@@ -1250,23 +1250,23 @@ class TestDsomCompilerNew extends Logging {
     assertEquals("four", four_3.name)
 
     val elemsFollowingC = c.possibleNextTerms
-    val Seq(two_4: LocalElementBase, three_4: LocalElementBase, seqFollowingThree_4: Sequence) = c.possibleNextTerms
-    val Seq(four_4: LocalElementBase) = seqFollowingThree_4.groupMembers
+    val Seq(two_4: ElementBase, three_4: ElementBase, seqFollowingThree_4: Sequence) = c.possibleNextTerms
+    val Seq(four_4: ElementBase) = seqFollowingThree_4.groupMembers
     assertEquals(3, elemsFollowingC.length)
     assertEquals("two", two_4.name)
     assertEquals("three", three_4.name)
     assertEquals("four", four_4.name)
 
     val elemsFollowingTwo = two.possibleNextTerms
-    val Seq(three_5: LocalElementBase, seqFollowingThree_5: Sequence) = two.possibleNextTerms
-    val Seq(four_5: LocalElementBase) = seqFollowingThree_5.groupMembers
+    val Seq(three_5: ElementBase, seqFollowingThree_5: Sequence) = two.possibleNextTerms
+    val Seq(four_5: ElementBase) = seqFollowingThree_5.groupMembers
     assertEquals(2, elemsFollowingTwo.length)
     assertEquals("three", three_5.name)
     assertEquals("four", four_5.name)
 
     val elemsFollowingThree = three.possibleNextTerms
     val Seq(seqFollowingThree_6: Sequence) = three.possibleNextTerms
-    val Seq(four_6: LocalElementBase) = seqFollowingThree_6.groupMembers
+    val Seq(four_6: ElementBase) = seqFollowingThree_6.groupMembers
     assertEquals(1, elemsFollowingThree.length)
     assertEquals("four", four_6.name)
 
@@ -1335,26 +1335,26 @@ class TestDsomCompilerNew extends Logging {
     val elemsFollowingRootSeq = rootCTSeq.possibleNextTerms
     assertEquals(0, elemsFollowingRootSeq.length)
 
-    val Seq(one: LocalElementBase, two: LocalElementBase, three: LocalElementBase) =
+    val Seq(one: ElementBase, two: ElementBase, three: ElementBase) =
       rootCTSeq.groupMembers // has an element and a sub-sequence as its children.
 
     val elemsFollowingOne = one.possibleNextTerms
     assertEquals(3, elemsFollowingOne.length)
-    assertEquals("one", elemsFollowingOne(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("two", elemsFollowingOne(1).asInstanceOf[LocalElementBase].name)
-    assertEquals("three", elemsFollowingOne(2).asInstanceOf[LocalElementBase].name)
+    assertEquals("one", elemsFollowingOne(0).asInstanceOf[ElementBase].name)
+    assertEquals("two", elemsFollowingOne(1).asInstanceOf[ElementBase].name)
+    assertEquals("three", elemsFollowingOne(2).asInstanceOf[ElementBase].name)
 
     val elemsFollowingTwo = two.possibleNextTerms
     assertEquals(3, elemsFollowingTwo.length)
-    assertEquals("one", elemsFollowingTwo(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("two", elemsFollowingTwo(1).asInstanceOf[LocalElementBase].name)
-    assertEquals("three", elemsFollowingTwo(2).asInstanceOf[LocalElementBase].name)
+    assertEquals("one", elemsFollowingTwo(0).asInstanceOf[ElementBase].name)
+    assertEquals("two", elemsFollowingTwo(1).asInstanceOf[ElementBase].name)
+    assertEquals("three", elemsFollowingTwo(2).asInstanceOf[ElementBase].name)
 
     val elemsFollowingThree = three.possibleNextTerms
     assertEquals(3, elemsFollowingThree.length)
-    assertEquals("one", elemsFollowingThree(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("two", elemsFollowingThree(1).asInstanceOf[LocalElementBase].name)
-    assertEquals("three", elemsFollowingThree(2).asInstanceOf[LocalElementBase].name)
+    assertEquals("one", elemsFollowingThree(0).asInstanceOf[ElementBase].name)
+    assertEquals("two", elemsFollowingThree(1).asInstanceOf[ElementBase].name)
+    assertEquals("three", elemsFollowingThree(2).asInstanceOf[ElementBase].name)
   }
 
   /**
@@ -1419,26 +1419,26 @@ class TestDsomCompilerNew extends Logging {
     val elemsFollowingRootSeq = rootCTSeq.possibleNextTerms
     assertEquals(0, elemsFollowingRootSeq.length)
 
-    val Seq(one: LocalElementBase, two: LocalElementBase, three: LocalElementBase) =
+    val Seq(one: ElementBase, two: ElementBase, three: ElementBase) =
       rootCTSeq.groupMembers
 
     val elemsFollowingOne = one.possibleNextTerms
     assertEquals(3, elemsFollowingOne.length)
-    assertEquals("one", elemsFollowingOne(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("two", elemsFollowingOne(1).asInstanceOf[LocalElementBase].name)
-    assertEquals("three", elemsFollowingOne(2).asInstanceOf[LocalElementBase].name)
+    assertEquals("one", elemsFollowingOne(0).asInstanceOf[ElementBase].name)
+    assertEquals("two", elemsFollowingOne(1).asInstanceOf[ElementBase].name)
+    assertEquals("three", elemsFollowingOne(2).asInstanceOf[ElementBase].name)
 
     val elemsFollowingTwo = two.possibleNextTerms
     assertEquals(3, elemsFollowingTwo.length)
-    assertEquals("one", elemsFollowingTwo(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("two", elemsFollowingTwo(1).asInstanceOf[LocalElementBase].name)
-    assertEquals("three", elemsFollowingTwo(2).asInstanceOf[LocalElementBase].name)
+    assertEquals("one", elemsFollowingTwo(0).asInstanceOf[ElementBase].name)
+    assertEquals("two", elemsFollowingTwo(1).asInstanceOf[ElementBase].name)
+    assertEquals("three", elemsFollowingTwo(2).asInstanceOf[ElementBase].name)
 
     val elemsFollowingThree = three.possibleNextTerms
     assertEquals(3, elemsFollowingThree.length)
-    assertEquals("one", elemsFollowingThree(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("two", elemsFollowingThree(1).asInstanceOf[LocalElementBase].name)
-    assertEquals("three", elemsFollowingThree(2).asInstanceOf[LocalElementBase].name)
+    assertEquals("one", elemsFollowingThree(0).asInstanceOf[ElementBase].name)
+    assertEquals("two", elemsFollowingThree(1).asInstanceOf[ElementBase].name)
+    assertEquals("three", elemsFollowingThree(2).asInstanceOf[ElementBase].name)
   }
 
   /**
@@ -1517,7 +1517,7 @@ class TestDsomCompilerNew extends Logging {
     val oneCTSeq = oneCT.sequence
     val elemsFollowingOneCTSeq = oneCTSeq.possibleNextTerms
 
-    val Seq(one_1: LocalElementBase, two_1: LocalElementBase, three_1: LocalElementBase) = oneCTSeq.possibleNextTerms
+    val Seq(one_1: ElementBase, two_1: ElementBase, three_1: ElementBase) = oneCTSeq.possibleNextTerms
     assertEquals(3, elemsFollowingOneCTSeq.length)
     assertEquals("one", one_1.name)
     assertEquals("two", two_1.name)
@@ -1527,24 +1527,24 @@ class TestDsomCompilerNew extends Logging {
 
     val elemsFollowingA = a.possibleNextTerms
     assertEquals(6, elemsFollowingA.length)
-    assertEquals("a", elemsFollowingA(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("b", elemsFollowingA(1).asInstanceOf[LocalElementBase].name)
-    assertEquals("c", elemsFollowingA(2).asInstanceOf[LocalElementBase].name)
-    assertEquals("one", elemsFollowingA(3).asInstanceOf[LocalElementBase].name)
-    assertEquals("two", elemsFollowingA(4).asInstanceOf[LocalElementBase].name)
-    assertEquals("three", elemsFollowingA(5).asInstanceOf[LocalElementBase].name)
+    assertEquals("a", elemsFollowingA(0).asInstanceOf[ElementBase].name)
+    assertEquals("b", elemsFollowingA(1).asInstanceOf[ElementBase].name)
+    assertEquals("c", elemsFollowingA(2).asInstanceOf[ElementBase].name)
+    assertEquals("one", elemsFollowingA(3).asInstanceOf[ElementBase].name)
+    assertEquals("two", elemsFollowingA(4).asInstanceOf[ElementBase].name)
+    assertEquals("three", elemsFollowingA(5).asInstanceOf[ElementBase].name)
 
     val elemsFollowingB = b.possibleNextTerms
     assertEquals(6, elemsFollowingB.length)
-    assertEquals("a", elemsFollowingB(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("b", elemsFollowingB(1).asInstanceOf[LocalElementBase].name)
-    assertEquals("c", elemsFollowingB(2).asInstanceOf[LocalElementBase].name)
-    assertEquals("one", elemsFollowingB(3).asInstanceOf[LocalElementBase].name)
-    assertEquals("two", elemsFollowingB(4).asInstanceOf[LocalElementBase].name)
-    assertEquals("three", elemsFollowingB(5).asInstanceOf[LocalElementBase].name)
+    assertEquals("a", elemsFollowingB(0).asInstanceOf[ElementBase].name)
+    assertEquals("b", elemsFollowingB(1).asInstanceOf[ElementBase].name)
+    assertEquals("c", elemsFollowingB(2).asInstanceOf[ElementBase].name)
+    assertEquals("one", elemsFollowingB(3).asInstanceOf[ElementBase].name)
+    assertEquals("two", elemsFollowingB(4).asInstanceOf[ElementBase].name)
+    assertEquals("three", elemsFollowingB(5).asInstanceOf[ElementBase].name)
 
     val elemsFollowingC = c.possibleNextTerms
-    val Seq(a_2: LocalElementBase, b_2: LocalElementBase, c_2: LocalElementBase, one_2: LocalElementBase, two_2: LocalElementBase, three_2: LocalElementBase) = c.possibleNextTerms
+    val Seq(a_2: ElementBase, b_2: ElementBase, c_2: ElementBase, one_2: ElementBase, two_2: ElementBase, three_2: ElementBase) = c.possibleNextTerms
     assertEquals(6, elemsFollowingC.length)
     assertEquals("a", a_2.name)
     assertEquals("b", b_2.name)
@@ -1554,14 +1554,14 @@ class TestDsomCompilerNew extends Logging {
     assertEquals("three", three_2.name)
 
     val elemsFollowingTwo = two.possibleNextTerms
-    val Seq(one_3: LocalElementBase, two_3: LocalElementBase, three_3: LocalElementBase) = two.possibleNextTerms
+    val Seq(one_3: ElementBase, two_3: ElementBase, three_3: ElementBase) = two.possibleNextTerms
     assertEquals(3, elemsFollowingTwo.length)
     assertEquals("one", one_3.name)
     assertEquals("two", two_3.name)
     assertEquals("three", three_3.name)
 
     val elemsFollowingThree = three.possibleNextTerms
-    val Seq(one_4: LocalElementBase, two_4: LocalElementBase, three_4: LocalElementBase) = three.possibleNextTerms
+    val Seq(one_4: ElementBase, two_4: ElementBase, three_4: ElementBase) = three.possibleNextTerms
     assertEquals(3, elemsFollowingThree.length)
     assertEquals("one", one_4.name)
     assertEquals("two", two_4.name)
@@ -1644,7 +1644,7 @@ class TestDsomCompilerNew extends Logging {
     val oneCTSeq = oneCT.sequence
     val elemsFollowingOneCTSeq = oneCTSeq.possibleNextTerms
 
-    val Seq(one_1: LocalElementBase, two_1: LocalElementBase, three_1: LocalElementBase) = oneCTSeq.possibleNextTerms
+    val Seq(one_1: ElementBase, two_1: ElementBase, three_1: ElementBase) = oneCTSeq.possibleNextTerms
     assertEquals(3, elemsFollowingOneCTSeq.length)
     assertEquals("one", one_1.name)
     assertEquals("two", two_1.name)
@@ -1654,28 +1654,28 @@ class TestDsomCompilerNew extends Logging {
 
     val elemsFollowingA = a.possibleNextTerms
     assertEquals(1, elemsFollowingA.length)
-    assertEquals("b", elemsFollowingA(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("b", elemsFollowingA(0).asInstanceOf[ElementBase].name)
 
     val elemsFollowingB = b.possibleNextTerms
     assertEquals(1, elemsFollowingB.length)
-    assertEquals("c", elemsFollowingB(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("c", elemsFollowingB(0).asInstanceOf[ElementBase].name)
 
     val elemsFollowingC = c.possibleNextTerms
-    val Seq(one_2: LocalElementBase, two_2: LocalElementBase, three_2: LocalElementBase) = c.possibleNextTerms
+    val Seq(one_2: ElementBase, two_2: ElementBase, three_2: ElementBase) = c.possibleNextTerms
     assertEquals(3, elemsFollowingC.length)
     assertEquals("one", one_2.name)
     assertEquals("two", two_2.name)
     assertEquals("three", three_2.name)
 
     val elemsFollowingTwo = two.possibleNextTerms
-    val Seq(one_3: LocalElementBase, two_3: LocalElementBase, three_3: LocalElementBase) = two.possibleNextTerms
+    val Seq(one_3: ElementBase, two_3: ElementBase, three_3: ElementBase) = two.possibleNextTerms
     assertEquals(3, elemsFollowingTwo.length)
     assertEquals("one", one_3.name)
     assertEquals("two", two_3.name)
     assertEquals("three", three_3.name)
 
     val elemsFollowingThree = three.possibleNextTerms
-    val Seq(one_4: LocalElementBase, two_4: LocalElementBase, three_4: LocalElementBase) = three.possibleNextTerms
+    val Seq(one_4: ElementBase, two_4: ElementBase, three_4: ElementBase) = three.possibleNextTerms
     assertEquals(3, elemsFollowingThree.length)
     assertEquals("one", one_4.name)
     assertEquals("two", two_4.name)

http://git-wip-us.apache.org/repos/asf/incubator-daffodil/blob/89517717/daffodil-core/src/test/scala-new/edu/illinois/ncsa/daffodil/dsom/TestMiddleEndAttributes3.scala
----------------------------------------------------------------------
diff --git a/daffodil-core/src/test/scala-new/edu/illinois/ncsa/daffodil/dsom/TestMiddleEndAttributes3.scala b/daffodil-core/src/test/scala-new/edu/illinois/ncsa/daffodil/dsom/TestMiddleEndAttributes3.scala
index 8472871..8ea89a5 100644
--- a/daffodil-core/src/test/scala-new/edu/illinois/ncsa/daffodil/dsom/TestMiddleEndAttributes3.scala
+++ b/daffodil-core/src/test/scala-new/edu/illinois/ncsa/daffodil/dsom/TestMiddleEndAttributes3.scala
@@ -138,7 +138,7 @@ class TestMiddleEndAttributes3 {
     assertNotNull(ile_nextSibling)
     val ilct = ile.complexType
     val ilseq = ilct.sequence
-    val Seq(_: ElementBase, _: Sequence, ipsrcle: ElementBase) = ilseq.groupMembers
+    val Seq(_: ElementBase, _: SequenceGroupRef, ipsrcle: ElementBase) = ilseq.groupMembers
     val nextSiblings = ipsrcle.nextSibling
     assertNotNull(nextSiblings)
     val nextParents = ipsrcle.nextParentElements

http://git-wip-us.apache.org/repos/asf/incubator-daffodil/blob/89517717/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestCouldBeNextElement.scala
----------------------------------------------------------------------
diff --git a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestCouldBeNextElement.scala b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestCouldBeNextElement.scala
index 1fc274f..159d1ec 100644
--- a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestCouldBeNextElement.scala
+++ b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestCouldBeNextElement.scala
@@ -55,10 +55,10 @@ class TestCouldBeNextElement {
               </xs:sequence>
               <xs:sequence>
               </xs:sequence>
-              <xs:element name="bar1" type="xs:string"/>
+              <xs:element name="bar1" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="1"/>
             </xs:choice>
-            <xs:element name="barOpt" minOccurs="0" dfdl:occursCountKind="implicit" type="xs:string"/>
-            <xs:element name="bar2" type="xs:string"/>
+            <xs:element name="barOpt" minOccurs="0" dfdl:occursCountKind="implicit" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="1"/>
+            <xs:element name="bar2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="1"/>
           </xs:sequence>
         </xs:complexType>
       </xs:element>)
@@ -72,25 +72,27 @@ class TestCouldBeNextElement {
 
     val rootCT = root.complexType
     val rootSeq = rootCT.sequence
-    val Seq(choice1: Choice, barOpt: LocalElementBase, bar2: LocalElementBase) = rootSeq.groupMembers
-    val Seq(choice1seq1: Sequence, choice1seq2: Sequence, bar1: LocalElementBase) = choice1.groupMembers
+    val Seq(choice1: Choice, barOpt: ElementBase, bar2: ElementBase) = rootSeq.groupMembers
+    val Seq(choice1seq1: Sequence, choice1seq2: Sequence, bar1: ElementBase) = choice1.groupMembers
     val Seq(gm: Sequence) = choice1seq1.groupMembers
     assertNotNull(gm)
 
     assertEquals(0, root.possibleNextChildElementsInInfoset.length)
     assertEquals(3, root.possibleFirstChildElementsInInfoset.length)
-    assertEquals("bar1", root.possibleFirstChildElementsInInfoset(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("barOpt", root.possibleFirstChildElementsInInfoset(1).asInstanceOf[LocalElementBase].name)
-    assertEquals("bar2", root.possibleFirstChildElementsInInfoset(2).asInstanceOf[LocalElementBase].name)
+    assertEquals("bar1", root.possibleFirstChildElementsInInfoset(0).asInstanceOf[ElementBase].name)
+    assertEquals("barOpt", root.possibleFirstChildElementsInInfoset(1).asInstanceOf[ElementBase].name)
+    assertEquals("bar2", root.possibleFirstChildElementsInInfoset(2).asInstanceOf[ElementBase].name)
 
+    //val bar1PFCEII = bar1.possibleFirstChildElementsInInfoset
+    //val bar1PNCEII = bar1.possibleNextChildElementsInInfoset
     assertEquals(0, bar1.possibleFirstChildElementsInInfoset.length)
     assertEquals(2, bar1.possibleNextChildElementsInInfoset.length)
-    assertEquals("barOpt", bar1.possibleNextChildElementsInInfoset(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("bar2", bar1.possibleNextChildElementsInInfoset(1).asInstanceOf[LocalElementBase].name)
+    assertEquals("barOpt", bar1.possibleNextChildElementsInInfoset(0).asInstanceOf[ElementBase].name)
+    assertEquals("bar2", bar1.possibleNextChildElementsInInfoset(1).asInstanceOf[ElementBase].name)
 
     assertEquals(0, barOpt.possibleFirstChildElementsInInfoset.length)
     assertEquals(1, barOpt.possibleNextChildElementsInInfoset.length)
-    assertEquals("bar2", barOpt.possibleNextChildElementsInInfoset(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("bar2", barOpt.possibleNextChildElementsInInfoset(0).asInstanceOf[ElementBase].name)
 
     assertEquals(0, bar2.possibleFirstChildElementsInInfoset.length)
     assertEquals(0, bar2.possibleNextChildElementsInInfoset.length)
@@ -139,24 +141,24 @@ class TestCouldBeNextElement {
 
     val rootCT = root.complexType
     val rootSeq = rootCT.sequence
-    val Seq(array: LocalElementBase, after: LocalElementBase) = rootSeq.groupMembers
+    val Seq(array: ElementBase, after: ElementBase) = rootSeq.groupMembers
     val arrayCT = array.complexType
     val choice = arrayCT.modelGroup.asInstanceOf[Choice]
-    val Seq(ch1: LocalElementBase, ch2: LocalElementBase, array2: LocalElementBase, choiceSeq: Sequence) = choice.groupMembers
+    val Seq(ch1: ElementBase, ch2: ElementBase, array2: ElementBase, choiceSeq: Sequence) = choice.groupMembers
 
     assertEquals(0, root.possibleNextChildElementsInInfoset.length)
     assertEquals(2, root.possibleFirstChildElementsInInfoset.length)
-    assertEquals("array", root.possibleFirstChildElementsInInfoset(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("after", root.possibleFirstChildElementsInInfoset(1).asInstanceOf[LocalElementBase].name)
+    assertEquals("array", root.possibleFirstChildElementsInInfoset(0).asInstanceOf[ElementBase].name)
+    assertEquals("after", root.possibleFirstChildElementsInInfoset(1).asInstanceOf[ElementBase].name)
 
     assertEquals(3, array.possibleFirstChildElementsInInfoset.length)
-    assertEquals("ch1", array.possibleFirstChildElementsInInfoset(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("ch2", array.possibleFirstChildElementsInInfoset(1).asInstanceOf[LocalElementBase].name)
-    assertEquals("array", array.possibleFirstChildElementsInInfoset(2).asInstanceOf[LocalElementBase].name)
+    assertEquals("ch1", array.possibleFirstChildElementsInInfoset(0).asInstanceOf[ElementBase].name)
+    assertEquals("ch2", array.possibleFirstChildElementsInInfoset(1).asInstanceOf[ElementBase].name)
+    assertEquals("array", array.possibleFirstChildElementsInInfoset(2).asInstanceOf[ElementBase].name)
 
     assertEquals(2, array.possibleNextChildElementsInInfoset.length)
-    assertEquals("array", array.possibleNextChildElementsInInfoset(0).asInstanceOf[LocalElementBase].name)
-    assertEquals("after", array.possibleNextChildElementsInInfoset(1).asInstanceOf[LocalElementBase].name)
+    assertEquals("array", array.possibleNextChildElementsInInfoset(0).asInstanceOf[ElementBase].name)
+    assertEquals("after", array.possibleNextChildElementsInInfoset(1).asInstanceOf[ElementBase].name)
 
     assertEquals(0, after.possibleFirstChildElementsInInfoset.length)
     assertEquals(0, after.possibleNextChildElementsInInfoset.length)
@@ -199,17 +201,17 @@ class TestCouldBeNextElement {
 
     val rootCT = root.complexType
     val rootSeq = rootCT.sequence
-    val Seq(e1: LocalElementBase, e2: LocalElementBase, e3: LocalElementBase) = rootSeq.groupMembers
+    val Seq(e1: ElementBase, e2: ElementBase, e3: ElementBase) = rootSeq.groupMembers
 
     assertEquals(0, root.possibleNextChildElementsInInfoset.length)
     assertEquals(1, root.possibleFirstChildElementsInInfoset.length)
-    assertEquals("e1", root.possibleFirstChildElementsInInfoset(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("e1", root.possibleFirstChildElementsInInfoset(0).asInstanceOf[ElementBase].name)
 
     assertEquals(1, e1.possibleNextChildElementsInInfoset.length)
-    assertEquals("e2", e1.possibleNextChildElementsInInfoset(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("e2", e1.possibleNextChildElementsInInfoset(0).asInstanceOf[ElementBase].name)
 
     assertEquals(1, e2.possibleNextChildElementsInInfoset.length)
-    assertEquals("e3", e2.possibleNextChildElementsInInfoset(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("e3", e2.possibleNextChildElementsInInfoset(0).asInstanceOf[ElementBase].name)
 
     assertEquals(0, e3.possibleNextChildElementsInInfoset.length)
   }
@@ -220,15 +222,15 @@ class TestCouldBeNextElement {
       <xs:element name="root">
         <xs:complexType>
           <xs:sequence>
-            <xs:element name="e1" type="xs:string" />
-            <xs:sequence dfdl:hiddenGroupRef="g1_hidden" />
-            <xs:element name="e2" type="xs:string" dfdl:occursCountKind="parsed" />
+            <xs:element name="e1" type="xs:string"/>
+            <xs:sequence dfdl:hiddenGroupRef="g1_hidden"/>
+            <xs:element name="e2" type="xs:string" dfdl:occursCountKind="parsed"/>
           </xs:sequence>
         </xs:complexType>
       </xs:element>
       <xs:group name="g1_hidden">
         <xs:sequence>
-          <xs:element name="e2_hidden" type="xs:string" dfdl:occursCountKind="parsed" />
+          <xs:element name="e2_hidden" type="xs:string" dfdl:occursCountKind="parsed"/>
         </xs:sequence>
       </xs:group>)
 
@@ -242,11 +244,11 @@ class TestCouldBeNextElement {
     assertEquals(0, root.possibleNextChildElementsInInfoset.length)
     assertEquals(1, root.possibleFirstChildElementsInInfoset.length)
 
-    val e1 = root.possibleFirstChildElementsInInfoset(0).asInstanceOf[LocalElementBase]
+    val e1 = root.possibleFirstChildElementsInInfoset(0).asInstanceOf[ElementBase]
 
     assertEquals("e1", e1.name)
     assertEquals(1, e1.possibleNextChildElementsInInfoset.length)
-    assertEquals("e2", e1.possibleNextChildElementsInInfoset(0).asInstanceOf[LocalElementBase].name)
+    assertEquals("e2", e1.possibleNextChildElementsInInfoset(0).asInstanceOf[ElementBase].name)
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-daffodil/blob/89517717/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestDsomCompiler.scala
----------------------------------------------------------------------
diff --git a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestDsomCompiler.scala b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestDsomCompiler.scala
index 9ed89d4..df2413d 100644
--- a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestDsomCompiler.scala
+++ b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestDsomCompiler.scala
@@ -45,7 +45,6 @@ import junit.framework.Assert._
 import edu.illinois.ncsa.daffodil.api.Diagnostic
 import edu.illinois.ncsa.daffodil.util.SchemaUtils
 import org.junit.Test
-import edu.illinois.ncsa.daffodil.util.Fakes
 import edu.illinois.ncsa.daffodil.schema.annotation.props.Found
 
 class TestDsomCompiler extends Logging {
@@ -61,7 +60,6 @@ class TestDsomCompiler extends Logging {
   // these tests don't use this. If you make this an eager val, then if there
   // is any problem in the Fakes, the whole class can't be constructed, and None
   // of the tests will run. Lazy lets this class be constructed no matter what.
-  lazy val dummyGroupRef = Fakes.fakeGroupRef
 
   @Test def testHasProps() {
     val testSchema = SchemaUtils.dfdlTestSchema(
@@ -229,7 +227,7 @@ class TestDsomCompiler extends Logging {
 
     val sset = new SchemaSet(testSchema)
     val Seq(sch) = sset.schemas
-    val Seq(sd) = sch.schemaDocuments
+    val Seq(sd, _) = sch.schemaDocuments
 
     // No annotations
     val Seq(gct) = sd.globalComplexTypeDefs
@@ -237,9 +235,10 @@ class TestDsomCompiler extends Logging {
 
     // Explore global element decl
     val Seq(e1f, e2f, e3f, _, _) = sd.globalElementDecls // there are 3 factories
-    val e1 = e1f.forRoot()
+    val root1 = e1f.forRoot()
+    val e1 = root1.referencedElement
     e2f.forRoot()
-    val e3 = e3f.forRoot()
+    val e3 = e3f.forRoot().referencedElement
     assertEquals(
       ByteOrder.BigEndian.toString.toLowerCase(),
       e1.formatAnnotation.asInstanceOf[DFDLElement].getProperty("byteOrder").toLowerCase())
@@ -278,29 +277,33 @@ class TestDsomCompiler extends Logging {
     assertEquals("%%", es) // has escapeCharacter="%%" (note: string literals not digested yet, so %% is %%, not %.
 
     // Explore global group defs
-    val Seq(gr1, gr2, _, _, _) = sd.globalGroupDefs // there are two
-    val seq1 = gr1.forGroupRef(dummyGroupRef, 1).modelGroup.asInstanceOf[Sequence]
+    val Seq(_, gedf, _*) = sd.globalElementDecls
+    val root = gedf.forRoot()
+    val seq1 = root.complexType.modelGroup.asInstanceOf[SequenceGroupRef]
+
+    val Seq(e1r: ElementRef, cgr: ChoiceGroupRef) = seq1.groupMembers
+
+    val Seq(ggd1, ggd2, _, _, _) = sd.globalGroupDefs // there are two
+    assertEquals("gr", ggd1.namedQName.local)
+    assertEquals("hiddenGroup", ggd2.namedQName.local)
 
     //Explore LocalSimpleTypeDef
-    val Seq(gr2c1, _, gr2c3) = gr2.forGroupRef(dummyGroupRef, 1).modelGroup.asInstanceOf[ModelGroup].groupMembers
-    val ist = gr2c3.asInstanceOf[LocalElementDecl].immediateType.get.asInstanceOf[LocalSimpleTypeDef]
+    val Seq(c1: LocalElementDecl, _: LocalElementDecl, c3: LocalElementDecl) = cgr.groupMembers
+    val ist = c3.asInstanceOf[LocalElementDecl].immediateType.get.asInstanceOf[LocalSimpleTypeDef]
     val istBase = ist.optRestriction.get.baseQName.toQNameString
     assertEquals("tns:aType", istBase)
 
     //Explore LocalElementDecl
-    val led = gr2c1.asInstanceOf[LocalElementDecl]
-    assertEquals(1, led.maxOccurs)
-    val Seq(leda) = led.annotationObjs
-    assertEquals("{ $myVar1 eq (+47 mod 4) }", leda.asInstanceOf[DFDLDiscriminator].testBody.get)
+    assertEquals(1, c1.maxOccurs)
+    val Seq(c1a) = c1.annotationObjs
+    assertEquals("{ $myVar1 eq (+47 mod 4) }", c1a.asInstanceOf[DFDLDiscriminator].testBody.get)
 
     // Explore sequence
-    val Seq(ann: DFDLSequence) = seq1.annotationObjs // one format annotation with a property
+    val Seq(ann: DFDLGroup) = seq1.annotationObjs // one format annotation with a property
     assertNotNull(ann)
     assertEquals(SeparatorPosition.Infix, seq1.separatorPosition)
-    val Seq(seq1e1, seq1s1) = seq1.groupMembers // has an element and a sub-sequence as its children.
-    assertEquals(2, seq1e1.asInstanceOf[ElementRef].maxOccurs)
-    assertEquals("ex:a", seq1e1.asInstanceOf[ElementRef].ref)
-    assertEquals(1, seq1s1.asInstanceOf[Sequence].groupMembers.length) // it has the hidden group
+    assertEquals(2, e1r.maxOccurs)
+    assertEquals("ex:a", e1r.ref)
   }
 
   @Test def test4 {
@@ -308,23 +311,28 @@ class TestDsomCompiler extends Logging {
 
     val sset = new SchemaSet(testSchema)
     val Seq(sch) = sset.schemas
-    val Seq(sd) = sch.schemaDocuments
+    val Seq(sd, _) = sch.schemaDocuments
+
+    // Explore global group defs
+    val Seq(_, gedf, _*) = sd.globalElementDecls
+    val root = gedf.forRoot()
+    val seq1 = root.complexType.modelGroup.asInstanceOf[SequenceGroupRef]
 
-    val Seq(_, gd2f, _, _, _) = sd.globalGroupDefs // Obtain Group nodes
-    val gd2 = gd2f.forGroupRef(dummyGroupRef, 1)
-    val ch1 = gd2.modelGroup.asInstanceOf[Choice] // Downcast child-node of group to Choice
-    val Seq(_, cd2, _) = ch1.groupMembers // Children nodes of Choice-node, there are 3
+    val Seq(_: ElementRef, gr: GroupRef) = seq1.groupMembers
+    val cgd = gr.groupDef.asInstanceOf[GlobalChoiceGroupDef]
+    val cgr = cgd.groupRef.asInstanceOf[ChoiceGroupRef]
+    val Seq(_, cd2: LocalElementDecl, _) = cgd.groupMembers // Children nodes of Choice-node, there are 3
 
     // val Seq(a1: DFDLChoice) = ch1.annotationObjs // Obtain the annotation object that is a child
     // of the group node.
 
-    assertEquals(AlignmentType.Implicit, ch1.alignment)
-    assertEquals(ChoiceLengthKind.Implicit, ch1.choiceLengthKind)
+    assertEquals(AlignmentType.Implicit, cgr.alignment)
+    assertEquals(ChoiceLengthKind.Implicit, cgr.choiceLengthKind)
 
-    val Seq(asrt1) = cd2.asInstanceOf[LocalElementDecl].annotationObjs // Obtain Annotation object that is child
+    val Seq(asrt1: DFDLAssert) = cd2.annotationObjs // Obtain Annotation object that is child
     // of cd2.
 
-    assertEquals("{ $myVar1 eq xs:int(xs:string(fn:round-half-to-even(8.5))) }", asrt1.asInstanceOf[DFDLAssert].testTxt)
+    assertEquals("{ $myVar1 eq xs:int(xs:string(fn:round-half-to-even(8.5))) }", asrt1.testTxt)
   }
 
   @Test def test_named_format_chaining {
@@ -338,7 +346,7 @@ class TestDsomCompiler extends Logging {
     val Seq(sd) = sch.schemaDocuments
 
     val Seq(ge1f, _, _, _, _, _) = sd.globalElementDecls // Obtain global element nodes
-    val ge1 = ge1f.forRoot()
+    val ge1 = ge1f.forRoot().referencedElement
     val Seq(a1: DFDLElement) = ge1.annotationObjs
 
     assertEquals(true, a1.verifyPropValue("occursCountKind", "parsed"))
@@ -407,7 +415,7 @@ class TestDsomCompiler extends Logging {
 
     val sset = new SchemaSet(testSchema)
     val Seq(sch) = sset.schemas
-    val Seq(sd) = sch.schemaDocuments
+    val Seq(sd, _) = sch.schemaDocuments
 
     // No annotations
     val Seq(gct) = sd.globalComplexTypeDefs
@@ -415,7 +423,7 @@ class TestDsomCompiler extends Logging {
 
     // Explore global element decl
     val Seq(e1f, e2f, e3f, _, _) = sd.globalElementDecls // there are 3 factories
-    val e1 = e1f.forRoot()
+    val e1 = e1f.forRoot().referencedElement
     e2f.forRoot()
     e3f.forRoot()
 
@@ -428,14 +436,14 @@ class TestDsomCompiler extends Logging {
     assertEquals("ex", baseQName.prefix.get)
     assertEquals("aaType", baseQName.local)
 
-    assertTrue(gs1.verifyPropValue("alignmentUnits", "bytes")) // SimpleType - Local
+    assertTrue(gs1.term.verifyPropValue("alignmentUnits", "bytes")) // SimpleType - Local
 
-    assertTrue(gs1.verifyPropValue("byteOrder", "bigEndian")) // SimpleType - Base
-    assertTrue(gs1.verifyPropValue("occursCountKind", "implicit")) // Default Format
-    assertTrue(gs1.verifyPropValue("representation", "text")) // Define Format - def1
-    assertTrue(gs1.verifyPropValue("encoding", "utf-8")) // Define Format - def1
-    assertTrue(gs1.verifyPropValue("textStandardBase", "10")) // Define Format - def2
-    assertTrue(gs1.verifyPropValue("escapeSchemeRef", "tns:quotingScheme")) // Define Format - def2
+    assertTrue(gs1.term.verifyPropValue("byteOrder", "bigEndian")) // SimpleType - Base
+    assertTrue(gs1.term.verifyPropValue("occursCountKind", "implicit")) // Default Format
+    assertTrue(gs1.term.verifyPropValue("representation", "text")) // Define Format - def1
+    assertTrue(gs1.term.verifyPropValue("encoding", "UTF-8")) // Define Format - def1
+    assertTrue(gs1.term.verifyPropValue("textStandardBase", "10")) // Define Format - def2
+    assertTrue(gs1.term.verifyPropValue("escapeSchemeRef", "tns:quotingScheme")) // Define Format - def2
 
     val gs3 = gs3f.forElement(e1) // Global SimpleType - aTypeError - overlapping base props
 
@@ -453,7 +461,7 @@ class TestDsomCompiler extends Logging {
 
     val sset = new SchemaSet(testSchema)
     val Seq(sch) = sset.schemas
-    val Seq(sd) = sch.schemaDocuments
+    val Seq(sd, _) = sch.schemaDocuments
 
     // No annotations
     val Seq(g) = sd.globalComplexTypeDefs;
@@ -467,13 +475,11 @@ class TestDsomCompiler extends Logging {
 
     val e4ct = e4.complexType
 
-    val e4ctgref = e4ct.modelGroup.asInstanceOf[GroupRef] // groupRefTests' local group decl
+    val e4ctgref = e4ct.modelGroup.asInstanceOf[GroupRef]
 
-    val myGlobal1 = e4ctgref.groupDef
+    val myGlobal1Seq = e4ctgref.asInstanceOf[SequenceTermBase]
 
-    val myGlobal1Seq = myGlobal1.modelGroup.asInstanceOf[Sequence]
-
-    val myGlobal2Seq = myGlobal1Seq.groupRefChildren(0).group.asInstanceOf[Sequence]
+    val myGlobal2Seq = myGlobal1Seq.groupMembers(0).asInstanceOf[SequenceGroupRef]
 
     // myGlobal1 Properties
     assertTrue(myGlobal1Seq.verifyPropValue("separator", ","))
@@ -488,11 +494,10 @@ class TestDsomCompiler extends Logging {
 
     val e5ct = e5.complexType
 
-    val e5ctgref = e5ct.modelGroup.asInstanceOf[GroupRef] // groupRefTestOverlap's local group decl
-
+    val e5ctgref = e5ct.modelGroup.asInstanceOf[SequenceGroupRef]
     val myGlobal3 = e5ctgref.groupDef
     // val myGlobal3Seq =
-    myGlobal3.modelGroup.asInstanceOf[Sequence]
+    myGlobal3.asInstanceOf[GlobalSequenceGroupDef]
 
     // Tests overlapping properties
     assertTrue(e5ctgref.isError)
@@ -552,7 +557,7 @@ class TestDsomCompiler extends Logging {
   @Test def testGetQName = {
     val testSchema = SchemaUtils.dfdlTestSchema(
       <dfdl:defineFormat name="ref1">
-        <dfdl:format initiator=":"/>
+        <dfdl:format initiator=":" alignmentUnits="bits"/>
       </dfdl:defineFormat>,
       <xs:element name="e1" dfdl:lengthKind="implicit" dfdl:ref="tns:ref1" type="xs:string">
       </xs:element>)
@@ -561,7 +566,7 @@ class TestDsomCompiler extends Logging {
     val Seq(sd, _) = sch.schemaDocuments
 
     val Seq(ge1f) = sd.globalElementDecls // Obtain global element nodes
-    val ge1 = ge1f.forRoot()
+    val ge1 = ge1f.forRoot().referencedElement
 
     val qn = ge1.formatAnnotation.resolveQName("tns:ref1")
     val nsURI = qn.namespace
@@ -602,7 +607,7 @@ class TestDsomCompiler extends Logging {
     val Seq(sd, _) = sch.schemaDocuments
 
     val Seq(ge1f) = sd.globalElementDecls // Obtain global element nodes
-    val ge1 = ge1f.forRoot()
+    val ge1 = ge1f.forRoot().referencedElement
 
     val seq = ge1.sequence
 
@@ -627,25 +632,23 @@ class TestDsomCompiler extends Logging {
 
     val sset = new SchemaSet(testSchema)
     val Seq(sch) = sset.schemas
-    val Seq(sd) = sch.schemaDocuments
+    val Seq(sd, _) = sch.schemaDocuments
 
-    // No annotations
-    // val Seq(ct) = sd.globalComplexTypeDefs
+    val Seq(_, gedf, _*) = sd.globalElementDecls
+    val root = gedf.forRoot()
+    val sgr = root.complexType.modelGroup.asInstanceOf[SequenceGroupRef]
 
-    // g1.name == "gr"
-    val Seq(g1: GlobalGroupDefFactory, _, _, _, _) = sd.globalGroupDefs
+    val Seq(e1r: ElementRef, cgr: ChoiceGroupRef) = sgr.groupMembers
 
-    val seq1 = g1.forGroupRef(dummyGroupRef, 1).modelGroup.asInstanceOf[Sequence]
+    assertEquals("hiddenGroup", cgr.groupDef.namedQName.local)
+    assertEquals(AlignmentType.Implicit, cgr.alignment)
 
-    // e1.ref == "ex:a"
-    val Seq(e1r: ElementRef, _: Sequence) = seq1.groupMembers
-    val e1 = e1r.referencedElement
     assertEquals(2, e1r.maxOccurs)
     assertEquals(1, e1r.minOccurs)
-    assertEquals(AlignmentUnits.Bytes, e1.alignmentUnits)
+    assertEquals(AlignmentUnits.Bytes, e1r.alignmentUnits)
     //assertEquals(true, e1.nillable) // TODO: e1.nillable doesn't exist?
     //assertEquals("%ES; %% %#0; %NUL;%ACK; foo%#rF2;%#rF7;bar %WSP*; %#2024;%#xAABB; &amp;&#2023;&#xCCDD; -1", e1.nilValue) // TODO: Do not equal each other!
-    assertEquals(NilKind.LiteralValue, e1.nilKind)
+    assertEquals(NilKind.LiteralValue, e1r.nilKind)
   }
 
   @Test def testPathWithIndexes() {
@@ -666,7 +669,7 @@ class TestDsomCompiler extends Logging {
     val Seq(sd, _) = sch.schemaDocuments
 
     val Seq(ge1f) = sd.globalElementDecls // Obtain global element nodes
-    val ge1 = ge1f.forRoot()
+    val ge1 = ge1f.forRoot().referencedElement
 
     val seq = ge1.sequence
 

http://git-wip-us.apache.org/repos/asf/incubator-daffodil/blob/89517717/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestMiddleEndAttributes.scala
----------------------------------------------------------------------
diff --git a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestMiddleEndAttributes.scala b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestMiddleEndAttributes.scala
index 75ec28b..02a747a 100644
--- a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestMiddleEndAttributes.scala
+++ b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/dsom/TestMiddleEndAttributes.scala
@@ -264,9 +264,6 @@ class TestMiddleEndAttributes {
     val e3seqImmediatelyEnclosingModelGroup = e3seq.immediatelyEnclosingModelGroup
     // Sequence inside an element doesn't have an immediately enclosing model group
     assertEquals(None, e3seqImmediatelyEnclosingModelGroup)
-    // Global element instance appears inside the group that immediately contains the
-    // element reference.
-    assertEquals(Some(eMsgChoice), e3.immediatelyEnclosingModelGroup)
     // element reference also contained inside same
     assertEquals(Some(eMsgChoice), e2ref.immediatelyEnclosingModelGroup)
 

http://git-wip-us.apache.org/repos/asf/incubator-daffodil/blob/89517717/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/schema/annotation/props/TestPropertyRuntime.scala
----------------------------------------------------------------------
diff --git a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/schema/annotation/props/TestPropertyRuntime.scala b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/schema/annotation/props/TestPropertyRuntime.scala
index 4e2d0fc..f4ca667 100644
--- a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/schema/annotation/props/TestPropertyRuntime.scala
+++ b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/schema/annotation/props/TestPropertyRuntime.scala
@@ -35,7 +35,7 @@ package edu.illinois.ncsa.daffodil.schema.annotation.props
 import junit.framework.Assert._
 import edu.illinois.ncsa.daffodil.exceptions.ThrowsSDE
 import org.junit.Test
-import edu.illinois.ncsa.daffodil.dsom.SchemaComponent
+import edu.illinois.ncsa.daffodil.dsom.SchemaComponentImpl
 import edu.illinois.ncsa.daffodil.util.Fakes
 import edu.illinois.ncsa.daffodil.dsom.NestingLexicalMixin
 
@@ -88,7 +88,7 @@ class TestPropertyRuntime {
 
 }
 
-class HasMixin extends SchemaComponent(<foo/>, null)
+class HasMixin extends SchemaComponentImpl(<foo/>, null)
   with TheExamplePropMixin
   with NestingLexicalMixin {
 

http://git-wip-us.apache.org/repos/asf/incubator-daffodil/blob/89517717/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/util/TestUtils.scala
----------------------------------------------------------------------
diff --git a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/util/TestUtils.scala b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/util/TestUtils.scala
index b7c1fc0..33b68b0 100644
--- a/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/util/TestUtils.scala
+++ b/daffodil-core/src/test/scala/edu/illinois/ncsa/daffodil/util/TestUtils.scala
@@ -227,6 +227,9 @@ object Fakes {
   def fakeElem = new Fakes().fakeElem
   def fakeSD = new Fakes().fakeSD
   def fakeGroupRef = new Fakes().fakeGroupRef
+  def fakeChoiceGroupRef = new Fakes().fakeChoiceGroupRef
+  def fakeSequenceGroupRef = new Fakes().fakeSequenceGroupRef
+  def fakeGroupRefFactory = new Fakes().fakeGroupRefFactory
 }
 
 class Fakes private () {
@@ -236,14 +239,20 @@ class Fakes private () {
     <xs:element name="fake2" type="tns:fakeCT"/>
     <xs:complexType name="fakeCT">
       <xs:sequence>
-        <xs:group ref="tns:fakeGroup"/>
+        <xs:group ref="tns:fakeChoiceGroup"/>
         <xs:element ref="tns:fake"/>
+        <xs:group ref="tns:fakeSequenceGroup"/>
       </xs:sequence>
     </xs:complexType>
-    <xs:group name="fakeGroup">
+    <xs:group name="fakeChoiceGroup">
       <xs:choice>
         <xs:sequence/>
       </xs:choice>
+    </xs:group>
+    <xs:group name="fakeSequenceGroup">
+      <xs:sequence>
+        <xs:sequence/>
+      </xs:sequence>
     </xs:group>)
   val DummyPrimitiveFactory = null
   val tunable = DaffodilTunables()
@@ -253,8 +262,11 @@ class Fakes private () {
   lazy val fakeElem = fakeSD.getGlobalElementDecl("fake").get.forRoot()
   lazy val fakeCT = fakeSD.getGlobalElementDecl("fake2").get.forRoot().typeDef.asInstanceOf[GlobalComplexTypeDef]
   lazy val fakeSequence = fakeCT.sequence
-  lazy val Seq(fs1, fs2) = fakeSequence.groupMembers
-  lazy val fakeGroupRef = fs1.asInstanceOf[GroupRef]
+  lazy val Seq(fs1, fs2, fs3) = fakeSequence.groupMembers
+  lazy val fakeChoiceGroupRef = fs1.asInstanceOf[ChoiceGroupRef]
+  lazy val fakeGroupRef = fakeChoiceGroupRef
+  lazy val fakeSequenceGroupRef = fs3.asInstanceOf[SequenceGroupRef]
+  lazy val fakeGroupRefFactory = new GroupRefFactory(fs1.xml, fs1, 1, false)
 
   class FakeDataProcessor extends DFDL.DataProcessor {
     protected var tunablesObj = DaffodilTunables()
@@ -273,9 +285,9 @@ class Fakes private () {
     def isError: Boolean = false
     def setTunables(tunables: DaffodilTunables): Unit = {}
     def setTunable(tunable: String, value: String): Unit = {}
-    def setTunables(tunables: Map[String,String]): Unit = {}
+    def setTunables(tunables: Map[String, String]): Unit = {}
     def getTunables(): DaffodilTunables = { tunablesObj }
-    
+
   }
   lazy val fakeDP = new FakeDataProcessor