tuxji commented on code in PR #1098:
URL: https://github.com/apache/daffodil/pull/1098#discussion_r1367636886


##########
daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/SchemaDocument.scala:
##########
@@ -212,6 +212,8 @@ final class SchemaDocument private (xmlSDoc: 
XMLSchemaDocument)
   final override lazy val optLexicalParent = Some(xmlSDoc)
   final override lazy val optXMLSchemaDocument = Some(xmlSDoc)
 
+  final lazy val version = (xml \ "@version").text

Review Comment:
   > Somewhere on WWW is a diatribe on why using namespace URIs with versions 
in them is so wrong wrong wrong as a versioning means for XSD schemas.
   
   The built-in XML Schema version attribute is orthogonal to and separate from 
any namespace URI.  We plan to take advantage of it to assign semantic versions 
(strings like "3.6.0") to our filters.



##########
daffodil-codegen-c/src/test/resources/org/apache/daffodil/codegen/c/simple.dfdl.xsd:
##########
@@ -18,45 +18,351 @@
 
 <schema
   targetNamespace="urn:simple"
+  version="2.1.1"
   xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";
+  xmlns:net="urn:network/format"
   xmlns:si="urn:simple"
   xmlns:xs="http://www.w3.org/2001/XMLSchema";
   xmlns="http://www.w3.org/2001/XMLSchema";>
 
-  <!-- Binary representation properties -->
+  <!-- Network order binary format (net:format) -->
 
-  <include 
schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+  <import namespace="urn:network/format" 
schemaLocation="network/format.dfdl.xsd"/>
   <annotation>
     <appinfo source="http://www.ogf.org/dfdl/";>
-      <dfdl:format
-        binaryBooleanFalseRep="0"
-        binaryBooleanTrueRep="1"
-        fillByte="%NUL;"
-        prefixIncludesPrefixLength="no"
-        ref="si:GeneralFormat"
-        representation="binary"/>
+      <dfdl:format ref="net:format"/>
     </appinfo>
   </annotation>
 
-  <!-- Root elements (pick only one) -->
-
-  <element name="simple-boolean" type="xs:boolean"/>
-  <element name="simple-byte" type="xs:byte"/>
-  <element name="simple-double" type="xs:double"/>
-  <element name="simple-float" type="xs:float"/>
-  <element name="simple-hexBinary" type="xs:hexBinary" dfdl:length="4" 
dfdl:lengthKind="explicit" dfdl:lengthUnits="bytes"/>
-  <element name="simple-hexBinaryPrefixed" type="xs:hexBinary" 
dfdl:lengthKind="prefixed" dfdl:lengthUnits="bytes" 
dfdl:prefixLengthType="si:prefixedCount"/>
-  <element name="simple-int" type="xs:int"/>
-  <element name="simple-integer" type="xs:integer" dfdl:length="4" 
dfdl:lengthKind="explicit" dfdl:lengthUnits="bytes"/>
-  <element name="simple-long" type="xs:long"/>
-  <element name="simple-nonNegativeInteger" type="xs:nonNegativeInteger" 
dfdl:length="4" dfdl:lengthKind="explicit" dfdl:lengthUnits="bytes"/>
-  <element name="simple-short" type="xs:short"/>
-  <element name="simple-unsignedByte" type="xs:unsignedByte"/>
-  <element name="simple-unsignedInt" type="xs:unsignedInt"/>
-  <element name="simple-unsignedLong" type="xs:unsignedLong"/>
-  <element name="simple-unsignedShort" type="xs:unsignedShort"/>
-
-  <!-- Simple data types -->
+  <!-- Simple type root elements (pick only one) -->
+
+  <element name="simple-boolean" type="si:simple-boolean"/>
+  <element name="simple-byte" type="si:simple-byte"/>
+  <element name="simple-double" type="si:simple-double"/>
+  <element name="simple-float" type="si:simple-float"/>
+  <element name="simple-hexBinary" type="si:simple-hexBinary"/>
+  <element name="simple-hexBinaryPrefixed" type="si:simple-hexBinaryPrefixed"/>
+  <element name="simple-int" type="si:simple-int"/>
+  <element name="simple-integer" type="si:simple-integer"/>
+  <element name="simple-long" type="si:simple-long"/>
+  <element name="simple-nonNegativeInteger" 
type="si:simple-nonNegativeInteger"/>
+  <element name="simple-short" type="si:simple-short"/>
+  <element name="simple-unsignedByte" type="si:simple-unsignedByte"/>
+  <element name="simple-unsignedInt" type="si:simple-unsignedInt"/>
+  <element name="simple-unsignedLong" type="si:simple-unsignedLong"/>
+  <element name="simple-unsignedShort" type="si:simple-unsignedShort"/>
+
+  <!-- Enumerations of simple type root elements (pick only one) -->
+
+  <!-- DFDL specification does not allow enumerations of boolean types -->
+  <element name="enum-byte" type="si:enum-byte"/>
+  <element name="enum-double" type="si:enum-double"/>
+  <element name="enum-float" type="si:enum-float"/>
+  <element name="enum-hexBinary" type="si:enum-hexBinary"/>
+  <element name="enum-hexBinaryPrefixed" type="si:enum-hexBinaryPrefixed"/>
+  <element name="enum-int" type="si:enum-int"/>
+  <element name="enum-integer" type="si:enum-integer"/>
+  <element name="enum-long" type="si:enum-long"/>
+  <element name="enum-nonNegativeInteger" type="si:enum-nonNegativeInteger"/>
+  <element name="enum-short" type="si:enum-short"/>
+  <element name="enum-unsignedByte" type="si:enum-unsignedByte"/>
+  <element name="enum-unsignedInt" type="si:enum-unsignedInt"/>
+  <element name="enum-unsignedLong" type="si:enum-unsignedLong"/>
+  <element name="enum-unsignedShort" type="si:enum-unsignedShort"/>
+
+  <!-- Ranges of simple type root elements (pick only one) -->
+
+  <!-- DFDL specification does not allow ranges of boolean types -->
+  <element name="range-byte" type="si:range-byte"/>
+  <element name="range-double" type="si:range-double"/>
+  <element name="range-float" type="si:range-float"/>
+  <!-- DFDL specification does not allow ranges of hexBinary types -->
+  <element name="range-int" type="si:range-int"/>
+  <element name="range-integer" type="si:range-integer"/>
+  <element name="range-long" type="si:range-long"/>
+  <element name="range-nonNegativeInteger" type="si:range-nonNegativeInteger"/>
+  <element name="range-short" type="si:range-short"/>
+  <element name="range-unsignedByte" type="si:range-unsignedByte"/>
+  <element name="range-unsignedInt" type="si:range-unsignedInt"/>
+  <element name="range-unsignedLong" type="si:range-unsignedLong"/>
+  <element name="range-unsignedShort" type="si:range-unsignedShort"/>
+
+  <!-- All-in-one root element (pick when you want everything) -->
+
+  <element name="simple">
+    <xs:complexType>
+      <sequence>
+        <!-- All simple types -->
+        <element name="simple-boolean" type="si:simple-boolean"/>
+        <element name="simple-byte" type="si:simple-byte"/>
+        <element name="simple-double" type="si:simple-double"/>
+        <element name="simple-float" type="si:simple-float"/>
+        <element name="simple-hexBinary" type="si:simple-hexBinary"/>
+        <element name="simple-hexBinaryPrefixed" 
type="si:simple-hexBinaryPrefixed"/>
+        <element name="simple-int" type="si:simple-int"/>
+        <element name="simple-integer" type="si:simple-integer"/>
+        <element name="simple-long" type="si:simple-long"/>
+        <element name="simple-nonNegativeInteger" 
type="si:simple-nonNegativeInteger"/>
+        <element name="simple-short" type="si:simple-short"/>
+        <element name="simple-unsignedByte" type="si:simple-unsignedByte"/>
+        <element name="simple-unsignedInt" type="si:simple-unsignedInt"/>
+        <element name="simple-unsignedLong" type="si:simple-unsignedLong"/>
+        <element name="simple-unsignedShort" type="si:simple-unsignedShort"/>
+        <!-- All enumerations of simple types -->
+        <element name="enum-byte" type="si:enum-byte"/>
+        <element name="enum-double" type="si:enum-double"/>
+        <element name="enum-float" type="si:enum-float"/>
+        <element name="enum-hexBinary" type="si:enum-hexBinary"/>
+        <element name="enum-hexBinaryPrefixed" 
type="si:enum-hexBinaryPrefixed"/>
+        <element name="enum-int" type="si:enum-int"/>
+        <element name="enum-integer" type="si:enum-integer"/>
+        <element name="enum-long" type="si:enum-long"/>
+        <element name="enum-nonNegativeInteger" 
type="si:enum-nonNegativeInteger"/>
+        <element name="enum-short" type="si:enum-short"/>
+        <element name="enum-unsignedByte" type="si:enum-unsignedByte"/>
+        <element name="enum-unsignedInt" type="si:enum-unsignedInt"/>
+        <element name="enum-unsignedLong" type="si:enum-unsignedLong"/>
+        <element name="enum-unsignedShort" type="si:enum-unsignedShort"/>
+        <!-- All ranges of simple types -->
+        <element name="range-byte" type="si:range-byte"/>
+        <element name="range-double" type="si:range-double"/>
+        <element name="range-float" type="si:range-float"/>
+        <element name="range-int" type="si:range-int"/>
+        <element name="range-integer" type="si:range-integer"/>
+        <element name="range-long" type="si:range-long"/>
+        <element name="range-nonNegativeInteger" 
type="si:range-nonNegativeInteger"/>
+        <element name="range-short" type="si:range-short"/>
+        <element name="range-unsignedByte" type="si:range-unsignedByte"/>
+        <element name="range-unsignedInt" type="si:range-unsignedInt"/>
+        <element name="range-unsignedLong" type="si:range-unsignedLong"/>
+        <element name="range-unsignedShort" type="si:range-unsignedShort"/>
+      </sequence>
+    </xs:complexType>
+  </element>
+
+  <!-- Simple types without any schema facets -->
+
+  <simpleType name="simple-boolean">
+    <restriction base="xs:boolean"/>
+  </simpleType>
+  <simpleType name="simple-byte">
+    <restriction base="xs:byte"/>
+  </simpleType>
+  <simpleType name="simple-double">
+    <restriction base="xs:double"/>
+  </simpleType>
+  <simpleType name="simple-float">
+    <restriction base="xs:float"/>
+  </simpleType>
+  <simpleType name="simple-hexBinary"
+              dfdl:length="4"
+              dfdl:lengthKind="explicit"
+              dfdl:lengthUnits="bytes">
+    <restriction base="xs:hexBinary"/>
+  </simpleType>
+  <simpleType name="simple-hexBinaryPrefixed"
+              dfdl:prefixLengthType="si:prefixedCount"
+              dfdl:lengthKind="prefixed"

Review Comment:
   I didn't know about this requirement until now.  It would be a good idea to 
implement prefix value checking, but not in this PR (going on vacation soon).



##########
daffodil-codegen-c/src/test/resources/org/apache/daffodil/codegen/c/network/format.dfdl.xsd:
##########
@@ -0,0 +1,50 @@
+<?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.
+-->
+
+<!-- Network order binary format: 
<https://en.wikipedia.org/wiki/Endianness#Networking> -->

Review Comment:
   OK, Network order big endian format.



##########
daffodil-codegen-c/src/test/resources/org/apache/daffodil/codegen/c/network/format.dfdl.xsd:
##########
@@ -0,0 +1,50 @@
+<?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.
+-->
+
+<!-- Network order binary format: 
<https://en.wikipedia.org/wiki/Endianness#Networking> -->
+
+<schema
+  targetNamespace="urn:network/format"
+  xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";
+  xmlns:net="urn:network/format"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema";
+  xmlns="http://www.w3.org/2001/XMLSchema";>
+
+  <!-- Network order binary format (net:format) -->
+
+  <include 
schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+  <annotation>
+    <appinfo source="http://www.ogf.org/dfdl/";>
+      <dfdl:defineFormat name="format">
+        <dfdl:format

Review Comment:
   All right, adding byteOrder as bigEndian and bitOrder as 
mostSignificantBitFirst to the format.



##########
daffodil-codegen-c/src/test/resources/org/apache/daffodil/codegen/c/ex_nums.dfdl.xsd:
##########
@@ -17,184 +17,197 @@
 -->
 
 <xs:schema
-        elementFormDefault="qualified"
-        targetNamespace="http://example.com";
-        xmlns="http://example.com";
-        xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";
-        xmlns:xs="http://www.w3.org/2001/XMLSchema";>
+  elementFormDefault="qualified"
+  targetNamespace="http://example.com";
+  version="1.2.3"
+  xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";
+  xmlns:net="urn:network/format"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema";
+  xmlns="http://example.com";>
 
-    <!-- Representation property bindings -->
+  <!-- Network order binary format (net:format) -->

Review Comment:
   OK, saying `Network order big endian format (net:format)`.



-- 
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]

Reply via email to