mbeckerle commented on a change in pull request #23: This fix done for 
nato-stanag-5516 latest schema.
URL: https://github.com/apache/incubator-daffodil/pull/23#discussion_r160847030
 
 

 ##########
 File path: 
daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/infoset/InfosetImpl.scala
 ##########
 @@ -1334,10 +1334,29 @@ sealed class DIComplex(override val erd: 
ElementRuntimeData, val tunable: Daffod
     getChild(erd.dpathElementCompileInfo)
   }
 
+  private def noQuerySupportCheck(nodes: Seq[DINode], info: 
DPathElementCompileInfo) = {
+    if (nodes.length > 1) {
+      // might be more than one result
+      // but we have to rule out there being an empty DIArray
+      val withoutEmptyArrays = nodes.filter { node =>
+        node match {
+          case a: DIArray if a.length == 0 => false
+          case _ => true
+        }
+      }
+      if (withoutEmptyArrays.length > 1)
+        info.SDE("Path step '%s' ambiguous. More than one infoset node 
corresponds to this name.\n" +
+          "Query-style expressions are not supported.", 
info.namedQName.toExtendedSyntax)
+    }
+  }
+
   final def getChild(info: DPathElementCompileInfo): InfosetElement = {
-    if (nameToChildNodeLookup.containsKey(info.namedQName))
-      
nameToChildNodeLookup.get(info.namedQName)(0).asInstanceOf[InfosetElement]
-    else
+    if (nameToChildNodeLookup.containsKey(info.namedQName)) {
+      val nodes = nameToChildNodeLookup.get(info.namedQName)
+      noQuerySupportCheck(nodes, info)
+      val node = nodes(0).asInstanceOf[InfosetElement]
+      node
+    } else
 
 Review comment:
   Please see this additional pull request. I didn't want to rebase or all the 
comment log would be lost, so I rebased on a different branch, then isolated 
just the changes needed to rebase from this commit. 
   
   This is the changes needed to rebase this onto master:
   https://github.com/mbeckerle/incubator-daffodil/pull/4
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to