mbeckerle commented on a change in pull request #49: Daffodil 1907 non dfdl 
annotation
URL: https://github.com/apache/incubator-daffodil/pull/49#discussion_r171311966
 
 

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaDocument.scala
 ##########
 @@ -124,6 +125,46 @@ final class XMLSchemaDocument(xmlArg: Node,
     res
   }.value
 
+  /**
+   *  True if root xs:schema element has an xmlns that uses the DFDL URI.
+   *
+   *  This could be a prefix definition (Most likely xmlns:dfdl='...' but could
+   *  be some other prefix.)
+   *
+   *  Or very very unlikely, it could be the default namespace.
+   */
+  private def hasDFDLNamespaceDefinition: Boolean = {
+    val scope = xml.scope
+    val pre = scope.getPrefix(XMLUtils.DFDL_NAMESPACE)
+    val hasSomePrefixForDFDLNamespace = pre ne null
+    val res = hasSomePrefixForDFDLNamespace ||
+      {
+        val default = scope.getURI(null)
+        val hasDefaultNamespaceAsDFDLNamespace = default == 
XMLUtils.DFDL_NAMESPACE.toString
+        hasDefaultNamespaceAsDFDLNamespace
+      }
 
 Review comment:
   Yes, another way to do this is
   {code}
   val = cheapThingToCompute = .....
   lazy val = expensiveThingToCompute = ....
   val res = cheapThingToCompute || expensiveThingToCompute
   {code}
   This gets the clarity and the efficiency minus the lazy val overhead. I 
wouldn't do this is the runtime though, but in the compiler I'm ok with it. 

----------------------------------------------------------------
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