You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by mb...@apache.org on 2020/05/13 18:52:56 UTC

[incubator-daffodil] branch master updated: Correct invalid tdml files that should be valid.

This is an automated email from the ASF dual-hosted git repository.

mbeckerle pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git


The following commit(s) were added to refs/heads/master by this push:
     new dab5597  Correct invalid tdml files that should be valid.
dab5597 is described below

commit dab55975d6bb0e252b068cb97818253dcffcc141
Author: Michael Beckerle <mb...@tresys.com>
AuthorDate: Fri Jun 21 13:39:49 2019 -0400

    Correct invalid tdml files that should be valid.
    
    Mostly this is missing definitions for ex:, tns: and dfdlx:
    
    This is progress on DAFFODIL-1638.
    
    Removed dfdl-config-format.xsd This was redundantly defining the dafext
    namespace. Unusable that way in conjunction with the dafext.xsd file.
    
    Nothing was including/importing this file anyway.
    
    Moved the one definition in it, of dfdlConfig to dafext.xsd.
    
    Fix XML Catalog entries that lacked org/apache/daffodil in paths.
    
    Remove xsi:schemaLocation which breaks CLI tests, due to bug DAFFODIL-2339
    
    DAFFODIL-1638
---
 .../src/main/resources/eclipse-xml-catalog.xml     | 18 +++++-----
 .../org/apache/daffodil/xsd/dfdl-config-format.xsd | 41 ----------------------
 .../resources/org/apache/daffodil/xsd/dafext.xsd   | 10 ++++++
 .../src/test/resources/testConfigFile.xml          |  2 +-
 .../extensions/type_calc/inputTypeCalc.tdml        |  1 +
 .../type_calc/inputTypeCalcExpression.tdml         |  1 +
 .../type_calc/inputTypeCalc_malformed.tdml         | 11 +++---
 .../type_calc/typeCalcFunctionErrors.tdml          |  1 +
 .../extensions/type_calc/typeCalcFunctions.tdml    |  3 +-
 .../section07/annotations/annotations.tdml         |  1 +
 .../external_variables/daffodil_config.xml         |  3 +-
 .../daffodil_config_cli_test.xml                   | 23 ++++++++++--
 .../calc_value_properties/inputValueCalc.tdml      |  4 +--
 13 files changed, 55 insertions(+), 64 deletions(-)

diff --git a/daffodil-lib/src/main/resources/eclipse-xml-catalog.xml b/daffodil-lib/src/main/resources/eclipse-xml-catalog.xml
index 0cd4034..68ea1a6 100644
--- a/daffodil-lib/src/main/resources/eclipse-xml-catalog.xml
+++ b/daffodil-lib/src/main/resources/eclipse-xml-catalog.xml
@@ -16,21 +16,19 @@
   limitations under the License.
 -->
 
-<catalog>
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
 	<uri name="http://www.ibm.com/xmlns/dfdl/testData"
-		uri="platform:/resource/daffodil-lib/src/main/resources/xsd/tdml.xsd" />
+		uri="platform:/resource/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/tdml.xsd" />
 	<uri name="http://www.ogf.org/dfdl/dfdl-1.0/"
-		uri="platform:/resource/daffodil-lib/resource_managed/main/xsd/DFDL_part3_model.xsd" />
+		uri="platform:/resource/daffodil-lib/resource_managed/main/org/apache/daffodil/xsd/DFDL_part3_model.xsd" />
 	<uri name="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
-		uri="platform:/resource/daffodil-lib/resource_managed/main/xsd/dfdlx.xsd" />
+		uri="platform:/resource/daffodil-lib/resource_managed/main/org/apache/daffodil/xsd/dfdlx.xsd" />
 	<uri name="http://www.w3.org/2001/XMLSchema"
-		uri="platform:/resource/daffodil-lib/src/main/resources/xsd/XMLSchema_for_DFDL.xsd" />
-	<public publicId="-//W3C//DTD XMLSCHEMA 200102//EN"
-		uri="platform:/resource/daffodil-lib/src/main/resources/xsd/XMLSchema.dtd" />
+		uri="platform:/resource/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/XMLSchema_for_DFDL.xsd" />
 	<public publicId="datatypes"
-		uri="platform:/resource/daffodil-lib/src/main/resources/xsd/datatypes.dtd" />
+		uri="platform:/resource/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/datatypes.dtd" />
 	<uri name="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
-		uri="platform:/resource/daffodil-lib/src/main/resources/xsd/dafext.xsd" />
+		uri="platform:/resource/daffodil-lib/resource_managed/main/org/apache/daffodil/xsd/dafext.xsd" />
 	<uri name="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:int"
-		uri="platform:/resource/daffodil-lib/src/main/resources/xsd/dafint.xsd" />
+		uri="platform:/resource/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/dafint.xsd" />
 </catalog>
diff --git a/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/dfdl-config-format.xsd b/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/dfdl-config-format.xsd
deleted file mode 100644
index 873320c..0000000
--- a/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/dfdl-config-format.xsd
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-    xmlns:xs="http://www.w3.org/2001/XMLSchema"
-	xmlns="http://www.w3.org/2001/XMLSchema" 
-    targetNamespace="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
-	xmlns:tns="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
-	elementFormDefault="unqualified" 
-    xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
-	<xsd:import namespace="http://www.w3.org/2001/XMLSchema" />
-	<xsd:include schemaLocation="dafext.xsd" /> 
-
-		<element name="dfdlConfig">
-			<complexType>
-				<sequence>
-					<element ref="tns:externalVariableBindings" minOccurs="0" />
-					<element ref="tns:tunables" minOccurs="0" />
-				</sequence>
-			</complexType>
-		</element>
-
-
-</xsd:schema>
diff --git a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
index eb7c1e5..64fe2ed 100644
--- a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
+++ b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
@@ -18,6 +18,7 @@
 
 <xs:schema
   targetNamespace="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
+  xmlns:tns="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
@@ -480,4 +481,13 @@
     </xs:list>
   </xs:simpleType>
 
+  <xs:element name="dfdlConfig">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="tns:externalVariableBindings" minOccurs="0" />
+        <xs:element ref="tns:tunables" minOccurs="0" />
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
 </xs:schema>
diff --git a/daffodil-tdml-processor/src/test/resources/testConfigFile.xml b/daffodil-tdml-processor/src/test/resources/testConfigFile.xml
index e3fac6b..50186c9 100644
--- a/daffodil-tdml-processor/src/test/resources/testConfigFile.xml
+++ b/daffodil-tdml-processor/src/test/resources/testConfigFile.xml
@@ -16,7 +16,7 @@
   limitations under the License.
 -->
 
-<tdml:defineConfig name="myConfig" xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2012:ext" xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
+<tdml:defineConfig name="myConfig" xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext" xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
   <daf:tunables>
     <daf:requireBitOrderProperty>true</daf:requireBitOrderProperty>
   </daf:tunables>
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalc.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalc.tdml
index c217c77..1fe8f8b 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalc.tdml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalc.tdml
@@ -21,6 +21,7 @@
   xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
   xmlns:fn="http://www.w3.org/2005/xpath-functions"
+  xmlns:tns="http://example.com"
   >
 
   <tdml:defineSchema name="inputTypeCalc-Embedded.dfdl.xsd">
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalcExpression.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalcExpression.tdml
index c3239bd..679a973 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalcExpression.tdml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalcExpression.tdml
@@ -21,6 +21,7 @@
   xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
   xmlns:fn="http://www.w3.org/2005/xpath-functions"
+  xmlns:tns="http://example.com"
   >
 
   <tdml:defineSchema name="inputTypeCalc-Embedded.dfdl.xsd">
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalc_malformed.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalc_malformed.tdml
index 5162064..4f7f801 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalc_malformed.tdml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/inputTypeCalc_malformed.tdml
@@ -17,9 +17,12 @@
 -->
 
 <tdml:testSuite xmlns:ex="http://example.com" xmlns="http://example.com"
-  xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
-  xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions" >
+  xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" 
+  xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
+  xmlns:tns="http://example.com"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema">
 
   <tdml:defineSchema name="inputTypeCalc-Embedded.dfdl.xsd">
 
@@ -40,7 +43,7 @@
     </xs:element>
 
     <xs:simpleType name="keysetValue_01_repType" dfdl:lengthKind="explicit" dfdl:length="1">
-      <xs:restriction base="xs:unsignedInt"/>
+      <xs:restriction base="xs:unsignedInt" />
     </xs:simpleType>
 
     <xs:simpleType name="keysetValue_01" dfdlx:repType="tns:keysetValue_01_repType">
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/typeCalcFunctionErrors.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/typeCalcFunctionErrors.tdml
index fc43f14..d292bde 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/typeCalcFunctionErrors.tdml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/typeCalcFunctionErrors.tdml
@@ -21,6 +21,7 @@
   xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
   xmlns:fn="http://www.w3.org/2005/xpath-functions"
+  xmlns:tns="http://example.com"
   >
 
   <tdml:defineSchema name="inputTypeCalcFunctionErrors-Embedded.dfdl.xsd">
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/typeCalcFunctions.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/typeCalcFunctions.tdml
index fb3cc50..849ea73 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/typeCalcFunctions.tdml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/extensions/type_calc/typeCalcFunctions.tdml
@@ -20,7 +20,8 @@
   xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
-  xmlns:fn="http://www.w3.org/2005/xpath-functions">
+  xmlns:fn="http://www.w3.org/2005/xpath-functions"
+  xmlns:tns="http://example.com">
 
   <tdml:defineSchema name="inputTypeCalc-Embedded.dfdl.xsd">
 
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section07/annotations/annotations.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/section07/annotations/annotations.tdml
index d948c48..73e9e45 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/section07/annotations/annotations.tdml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/section07/annotations/annotations.tdml
@@ -20,6 +20,7 @@
   xmlns:tns="http://example.com" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
   xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:fn="http://www.w3.org/2005/xpath-functions"
+  xmlns:ex="http://example.com"
   defaultRoundTrip="true">
 
   <defineSchema name="as1">
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config.xml b/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config.xml
index 83c0729..b5f90d8 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config.xml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config.xml
@@ -17,8 +17,7 @@
 -->
 
 <daf:dfdlConfig
-	xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext">
 	<daf:externalVariableBindings xmlns="http://www.w3.org/2001/XMLSchema"
 		xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ex="http://example.com">
 		<daf:bind name="ex:v_no_default">1</daf:bind>
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml b/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml
index 0a286f3..d8fd199 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml
@@ -16,10 +16,27 @@
   limitations under the License.
 -->
 
-<daf:dfdlConfig xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<!--
+  Note: Bug DAFFODIL-2339
+
+  We'd like to have these schemaLocation attributes on daf:dfdlConfig, but this breaks tests because
+  it tries to load the schema from the schemaLocation, and can't resolve org/apache/daffodil/xsd/dafext.xsd.
+
+  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.
+
+  The failure seems to happen earlier. A SAX fatal error is invoked when looking up dfdl:anyOther a symbol
+  in the dfdl schema annotation schemas, from the XMLSchema_for_DFDL.
+
+	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:dfdlConfig xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext">
 	<daf:externalVariableBindings xmlns="http://www.w3.org/2001/XMLSchema"
-		xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ex="http://example.com">
+		xmlns:ex="http://example.com">
 		<daf:bind name="ex:var1">-9</daf:bind>
 		<daf:bind name="ex:var3">-8</daf:bind>
 	</daf:externalVariableBindings>
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section17/calc_value_properties/inputValueCalc.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/section17/calc_value_properties/inputValueCalc.tdml
index 241290e..73269a9 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/section17/calc_value_properties/inputValueCalc.tdml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/section17/calc_value_properties/inputValueCalc.tdml
@@ -633,9 +633,9 @@
     <dfdl:format ref="ex:GeneralFormat" lengthKind="delimited"
       lengthUnits="bytes" encoding="UTF-8" separator="" initiator=""
       occursCountKind="parsed" ignoreCase="no" inputValueCalc="{ 5 }"
-      textNumberRep="standard" representation="text" />
+      textNumberRep="standard" representation="text"/>
 
-    <xs:element name="e1" type="xs:int" />
+    <xs:element name="e1" type="xs:int"  />
 
   </tdml:defineSchema>