stevedlawrence commented on code in PR #1314:
URL: https://github.com/apache/daffodil/pull/1314#discussion_r1773612882
##########
daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/SchemaDocIncludesAndImportsMixin.scala:
##########
@@ -93,6 +93,39 @@ trait SchemaDocIncludesAndImportsMixin { self:
XMLSchemaDocument =>
resultNS
}.value
+ /**
+ * when we resolve a QName reference, if that reference does not have a
prefix and there is no
+ * in-scope default namespace, then we use this namespace, which varies
depending on things
+ * like targetNamespace and whether this schema was included or imported
+ */
+ override lazy val noPrefixNamespace: NS = LV('noPrefixNamespace) {
+ ii match {
+ case Some(inc: Include) => {
+ // if this schema document was included in another document, then
either the two
+ // schemas already have the same targetNamespace or this schema has
no-namespace and
+ // is chameleoned into the targetNamespace of the including schema.
Either way, the
+ // resulting included elements are in the targetNamespace and so any
unprefixed
+ // references to those elements should use the including schemas
targetNamespace when
+ // resolving
+ inc.targetNamespace
+ }
+ case Some(imp: Import) => {
+ // if this schema document was imported and we don't have a default
namespace then any
+ // unprefixed references just resolve to NoNamespace. Note that if
this schema has a
+ // targetNamespace, then it can only reference elements that are
imported into it
+ // without a namespace
+ NoNamespace
+ }
+ case Some(_) => Assert.impossible()
+ case None => {
+ // if we weren't included or imported it means we are the bootstrap
schema. There are
+ // no references in a bootstrap schema, only an import of the real
schema, so this
+ // value doesn't really matter and should never be used.
+ NoNamespace
Review Comment:
It looks like codecov doesn't understand this code and can't properly detect
that there is no coverage. I've confirmed that this bit of code is never hit.
I'll change it to an Assert.impossible and update the comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]