stevedlawrence 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_r160785660
##########
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:
You probably want to rebase onto the latest master. That refactors some of
this code and adds a new findChild method. That method has some asserts that
require there only be a single element. Those asserts probably want to be
replaced with your noQuerySupportCheck function.
----------------------------------------------------------------
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