mbeckerle commented on code in PR #1067:
URL: https://github.com/apache/daffodil/pull/1067#discussion_r1293633655
##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/DaffodilXMLLoader.scala:
##########
@@ -251,26 +240,32 @@ class DFDLCatalogResolver private ()
None
}
case (null, sysId) => {
- // We did not get a catalog resolution of the nsURI, nor
- // a straight file resolution of the systemId, so we
- // use the systemId (which comes from the schemaLocation attribute)
- // and the classpath.
- val baseURI = if (baseURIString == null) None else Some(new
URI(baseURIString))
- val optURI = Misc.getResourceRelativeOption(sysId, baseURI)
+ // We did not get a catalog resolution of the nsURI. We now look for
the systemID (which
+ // comes from the schemaLocation attribute) on classpath or as a file.
Note that we
+ // ignore if boolean
Review Comment:
ignore if boolean..... what
##########
daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/IIBase.scala:
##########
@@ -184,10 +183,14 @@ abstract class IIBase(
if (prop.isDefined && prop.get ==
"edu/illinois/ncsa/daffodil/xsd/built-in-formats.xsd") {
SDW(
WarnID.DeprecatedBuiltInFormats,
- "schemaLocation property uses deprecated include/import of
edu/illinois/ncsa/daffodil/xsd/built-in-formats.xsd. Use
org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd instead and change the
dfdl:format ref to \"GeneralFormat\".",
+ "schemaLocation property uses deprecated include/import of
edu/illinois/ncsa/daffodil/xsd/built-in-formats.xsd. Use
/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd instead and change the
dfdl:format ref to \"GeneralFormat\".",
Review Comment:
It has been years. I think we should get rid of this feature. We need to add
that to a release note if we do, because it's a feature being removed.
##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala:
##########
@@ -1299,6 +1303,121 @@ Differences were (path, expected, actual):
}
} else maybePrefix(nsb.parent, uri)
}
+
+ /**
+ * Resolves an xs:include/xs:import schemaLocation to a URI
+ *
+ * Attempts to resolve a schemaLocation using a provided URI and contextURI,
where the context
+ * is the URI of the schema importing this schemaLocation.
+ *
+ * If schemaLocation is not a valid URI, an IllegalArgumentException is
thrown.
+ *
+ * If schemaLocation is not an absolute URI, then only the path component
should be provided,
+ * or an IllegalArgumentException is thrown.
+ *
+ * If schemaLocation is not an absolute URI, and the path component is
relative, then
+ * optContextURI must be provided or a usage exception is thrown.
+ *
+ * Returns None if this fails to resolve the schemaLocation to an URI that
exists. If this
+ * successfully resolves, it returns a Some containing a tuple of the URI
and a boolean that
+ * is true if a relative schemaLocation path was resolved absolutely on the
classpath and
+ * false otherwise. This capability may be disabled in the future.
+ */
+ def resolveSchemaLocation(
Review Comment:
We should consider factoring out a daffodil-resolver library that contains
the resolver stuff, and this utility.
Actually I guess breaking up daffodil-lib into compile-time and runtime
parts is a separate topic, but I think it needs to happen.
##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala:
##########
@@ -1299,6 +1303,121 @@ Differences were (path, expected, actual):
}
} else maybePrefix(nsb.parent, uri)
}
+
+ /**
+ * Resolves an xs:include/xs:import schemaLocation to a URI
+ *
+ * Attempts to resolve a schemaLocation using a provided URI and contextURI,
where the context
+ * is the URI of the schema importing this schemaLocation.
+ *
+ * If schemaLocation is not a valid URI, an IllegalArgumentException is
thrown.
+ *
+ * If schemaLocation is not an absolute URI, then only the path component
should be provided,
+ * or an IllegalArgumentException is thrown.
+ *
+ * If schemaLocation is not an absolute URI, and the path component is
relative, then
+ * optContextURI must be provided or a usage exception is thrown.
+ *
+ * Returns None if this fails to resolve the schemaLocation to an URI that
exists. If this
+ * successfully resolves, it returns a Some containing a tuple of the URI
and a boolean that
Review Comment:
It's worth using the word "compatibility" in here somewhere just for the
keyword search value.
##########
daffodil-cli/src/main/scala/org/apache/daffodil/cli/Main.scala:
##########
@@ -226,14 +226,30 @@ class CLIConf(arguments: Array[String], stdout:
PrintStream, stderr: PrintStream
implicit def rootNSConverter =
org.rogach.scallop.singleArgConverter[RefQName](qnameConvert _)
implicit def fileResourceURIConverter = singleArgConverter[URI]((s: String)
=> {
Review Comment:
Why is there one of these resolvers in the CLI? So it can find the main
schema on the classpath?
Add scaladoc motivating why this is needed.
--
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]