[
https://issues.apache.org/jira/browse/DAFFODIL-2339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17888751#comment-17888751
]
Olabusayo Kilo commented on DAFFODIL-2339:
------------------------------------------
So we narrowed down the cause of the failure to load to a Xerces bug in
[tokenizeSchemaLocationStr|file:/org/apache/daffodil/xsd/dafext.xsd] where it
absolutizes the passed in URI, so our /org/apache/daffodil/xsd/dafext.xsd
becomes file:/org/apache/daffodil/xsd/dafext.xsd, which when passed to our
entity resolver, we are unable to resolve.
On discussion with Steve, since xsi:schemaLocation allows downloading schemas
from the internet, it's not ideal to support it for schemas that could be used
in CDS. Especially since we already use dafext.xsd to validate the config
schema, providing the xsi:schemaLocation is redundant information so we
recommend this be resolved as "Won't Fix"
> CLI Test fails if xsi:schemaLocation added to config.xml file.
> --------------------------------------------------------------
>
> Key: DAFFODIL-2339
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2339
> Project: Daffodil
> Issue Type: Bug
> Components: CLI
> Affects Versions: 2.6.0
> Reporter: Mike Beckerle
> Assignee: Olabusayo Kilo
> Priority: Major
> Labels: beginner
>
> For CLI test_3507_CLI_Parsing_SimpleParse_SaveParser_extVars
> This specifies a config file on the command line via the path
> daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml
> This file contains
> {code}
> <daf:dfdlConfig
> xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext">
> <daf:externalVariableBindings xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:ex="http://example.com">
> <daf:bind name="ex:var1">-9</daf:bind>
> <daf:bind name="ex:var3">-8</daf:bind>
> </daf:externalVariableBindings>
> </daf:dfdlConfig>
> {code}
> It would be valuable to add xsi:schemaLocation to this so as to specify where
> the
> daf namespace schema is defined like so:
> {code}
> <daf:dfdlConfig xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext
> org/apache/daffodil/xsd/dafext.xsd">
> <daf:externalVariableBindings xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:ex="http://example.com">
> <daf:bind name="ex:var1">-9</daf:bind>
> <daf:bind name="ex:var3">-8</daf:bind>
> </daf:externalVariableBindings>
> </daf:dfdlConfig>
> {code}
> Unfortunately, that causes a failure:
> {code}
> /home/mbeckerle/dataiti/git/daffodil/daffodil-cli/target/universal/stage/bin/daffodil
> -v save-parser -s
> /home/mbeckerle/dataiti/git/daffodil/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd
> -r row -c
> /home/mbeckerle/dataiti/git/daffodil/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml
> test_3507.xsd.bin
> [info] Unable to resolve
> file:/home/mbeckerle/dataiti/git/daffodil/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/org/apache/daffodil/xsd/dafext.xsd
> in
> Some(file:/home/mbeckerle/dataiti/git/daffodil/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml)
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> !! An unexpected exception occurred. This is a bug! !!
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> Please report this bug and help us fix it:
> https://daffodil.apache.org/community/#issue-tracker
> Please include the following exception, the command you
> ran, and any input, schema, or tdml files used that led
> to this bug.
> org.xml.sax.SAXParseException; systemId:
> file:/home/mbeckerle/dataiti/git/daffodil/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml;
> lineNumber: 21; columnNumber: 110; schema_reference.4: Failed to read schema
> document
> 'file:/home/mbeckerle/dataiti/git/daffodil/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/org/apache/daffodil/xsd/dafext.xsd',
> because 1) could not find the document; 2) the document could not be read;
> 3) the root element of the document is not <xsd:schema>.
> at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> Source)
> at org.apache.xerces.util.ErrorHandlerWrapper.warning(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at
> org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaWarning(Unknown
> Source)
> at
> org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument1(Unknown
> Source)
> at
> org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument(Unknown
> Source)
> at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown
> Source)
> at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
> Source)
> at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
> Source)
> at
> org.apache.daffodil.xml.DFDLXercesAdapter.loadXML(DaffodilXMLLoader.scala:400)
> at scala.xml.factory.XMLLoader.load(XMLLoader.scala:56)
> at scala.xml.factory.XMLLoader.load$(XMLLoader.scala:56)
> at scala.xml.parsing.FactoryAdapter.load(FactoryAdapter.scala:38)
> at
> org.apache.daffodil.xml.DaffodilXMLLoader.load(DaffodilXMLLoader.scala:562)
> at
> org.apache.daffodil.configuration.ConfigurationLoader$.getConfiguration(ConfigurationLoader.scala:43)
> at
> org.apache.daffodil.configuration.ConfigurationLoader$.getConfiguration(ConfigurationLoader.scala:50)
> at org.apache.daffodil.Main$.loadConfigurationFile(Main.scala:589)
> at org.apache.daffodil.Main$.run(Main.scala:1181)
> at org.apache.daffodil.Main$.main(Main.scala:1379)
> {code}
> Simple things like adding an sbt dependency from daffodil-cli back to
> daffodil-lib, whether always or "it->test" dependent, don't fix this.
> The CLI is using DaffodilXMLLoader to load this config file, so the resolver
> should be doing the right thing by finding this dafext.xsd on the class path
> inside of daffodil-lib's jar.
>
> It seems to be erroring out because it is failing upon constructing and not
> finding the relative path, that is the path creating by concatenating this
> file's URL with the org/apache/daffodil/xsd/dafext.xsd. That should not be
> found, but it should then not fail, but go search the class path for the
> org/apache/daffodil/xsd/dafext.xsd.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)