stevedlawrence commented on a change in pull request #49: Daffodil 1907 non
dfdl annotation
URL: https://github.com/apache/incubator-daffodil/pull/49#discussion_r171228952
##########
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:
Could the inside of the brackets be moved to before the res so it just
becomes ``val res = hasSomePrefixForDFDLNamespace ||
hasDefaultNamespaceAsDFDLNamespace``? This currently avoids some code if DFDL
is the not the default namespace, but that doesn't seem all that intensive and
this is a bit hard to read.
----------------------------------------------------------------
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