Skip to content

Commit

Permalink
fixup! fixup! Address unexpected warnings
Browse files Browse the repository at this point in the history
- remove encodingErrorPolicy replace and use GeneralFormat instead
- add suppressSchemaDefinitionWarnings to some schema elements

DAFFODIL-2926
  • Loading branch information
olabusayoT committed Oct 3, 2024
1 parent 7c0198e commit 2466eaf
Show file tree
Hide file tree
Showing 27 changed files with 664 additions and 653 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:cd="urn:org.apache.daffodil.layers.checkDigit"
xmlns:ex="http://example.com"
xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
targetNamespace="http://example.com">

<include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd" />
Expand Down Expand Up @@ -69,6 +70,7 @@
dfdl:inputValueCalc='{ $cd:checkDigit }'/>
<element name="invalidCheckDigit" type="ex:alwaysInvalid" minOccurs="0"
dfdl:occursCountKind="expression"
daf:suppressSchemaDefinitionWarnings="facetExplicitLengthOutOfRange"
dfdl:occursCount="{ if (../checkDigit eq ../computedCheckDigit) then 0 else 1 }"/>
</sequence> <!-- checkDigit DFDL variable scope ends here -->
</complexType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<tdml:testSuite 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:ex="http://example.com"
xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
suiteName="generalUnparserTests">

<tdml:defineSchema name="fixedLengthStrings">
Expand All @@ -32,7 +33,9 @@
<xs:complexType>
<xs:sequence dfdl:initiator="[" dfdl:separator="," dfdl:terminator="]">
<xs:element name="s1" dfdl:lengthKind="explicit" dfdl:length="0" type="xs:string" dfdl:textPadKind='none'/>
<xs:element name="s2" dfdl:lengthKind="explicit" dfdl:length="1" type="xs:string" dfdl:textPadKind='none' default="broken"/>
<xs:element name="s2" dfdl:lengthKind="explicit" dfdl:length="1" type="xs:string" dfdl:textPadKind='none'
daf:suppressSchemaDefinitionWarnings="noEmptyDefault"
default="broken"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
defaultRoundTrip="true">

<tdml:defineSchema name="SimpleTypes-Embedded.dfdl.xsd">
<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormatPortable.dfdl.xsd"/>
<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<dfdl:format ref="ex:GeneralFormat" lengthKind="implicit" representation="text"
lengthUnits="bytes" encoding="US-ASCII" initiator="" terminator=""
separator="" textNumberCheckPolicy="lax" ignoreCase="no" textNumberRep="standard"
textPadKind="padChar" textTrimKind="padChar" encodingErrorPolicy="replace"/>
lengthUnits="bytes" encoding="US-ASCII" initiator="" terminator="" calendarTimeZone="UTC"
separator="" textNumberCheckPolicy="lax" ignoreCase="no" textNumberRep="standard"
textPadKind="padChar" textTrimKind="padChar"/>
<xs:element name="double" type="xs:double"/>
<xs:element name="int" type="xs:int"/>
<xs:element name="byte" type="xs:byte"/>
Expand All @@ -50,12 +50,9 @@
dfdl:length="13" />
<xs:element name="int02" type="xs:int" dfdl:lengthKind="explicit"
dfdl:length="11" />
<xs:element name="int03" type="xs:int" dfdl:representation="binary"
dfdl:binaryNumberRep="binary">
<xs:annotation>
<xs:appinfo source="http://www.ogf.org/dfdl/dfdl-1.0/" />
</xs:annotation>
</xs:element>
<xs:element name="int03" type="xs:int" dfdl:binaryNumberRep="binary"
dfdl:lengthKind="explicit"
dfdl:length="4"/>
<xs:element name="int04" type="xs:int" dfdl:lengthKind="explicit"
dfdl:length="10" />
<xs:element name="int05" type="xs:int" dfdl:lengthKind="explicit"
Expand Down Expand Up @@ -206,10 +203,9 @@
</tdml:defineSchema>

<tdml:defineSchema name="SimpleTypes-binary">
<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormatPortable.dfdl.xsd"/>
<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<dfdl:format ref="ex:GeneralFormat" representation="binary"
encodingErrorPolicy="replace"
lengthUnits="bytes"
lengthUnits="bytes" calendarTimeZone="UTC"
textPadKind="padChar" textTrimKind="padChar" />

<xs:element name="integer01" type="xs:integer" />
Expand Down Expand Up @@ -294,7 +290,7 @@
<xs:element name="dateBinBCD6" type="xs:date" dfdl:calendarPattern="MMddyyeee" dfdl:calendarPatternKind="explicit"
dfdl:lengthKind="explicit" dfdl:length="{ 3 }" dfdl:lengthUnits="bytes" dfdl:binaryCalendarRep="bcd"/>
<xs:element name="dateBinBCD7" type="xs:date" dfdl:calendarPattern="eMyy" dfdl:calendarPatternKind="explicit"
dfdl:lengthKind="explicit" dfdl:length="{ 2 }" dfdl:lengthUnits="bytes" dfdl:binaryCalendarRep="bcd"/>
dfdl:lengthKind="explicit" dfdl:length="{ 16 }" dfdl:lengthUnits="bits" dfdl:binaryCalendarRep="bcd"/>

<xs:element name="timeBinBCD" type="xs:time" dfdl:calendarPattern="HHmmss" dfdl:calendarPatternKind="explicit"
dfdl:lengthKind="explicit" dfdl:length="{ 3 }" dfdl:lengthUnits="bytes" dfdl:binaryCalendarRep="bcd"/>
Expand Down Expand Up @@ -355,7 +351,7 @@
</xs:element>

<xs:element name="dateTimeBinIBM4690Packed2" type="xs:dateTime" dfdl:calendarPattern="MMddyyyyHHmmss" dfdl:calendarPatternKind="explicit"
dfdl:lengthKind="explicit" dfdl:length="{ 7 }" dfdl:lengthUnits="bytes" dfdl:binaryCalendarRep="ibm4690Packed" />
dfdl:lengthKind="explicit" dfdl:length="{ 56 }" dfdl:lengthUnits="bits" dfdl:binaryCalendarRep="ibm4690Packed" />
<xs:element name="dateTimeBinIBM4690Packed3" type="xs:dateTime" dfdl:calendarPattern="MMddyyyyhhmmss" dfdl:calendarPatternKind="explicit"
dfdl:lengthKind="implicit" dfdl:lengthUnits="bytes" dfdl:binaryCalendarRep="ibm4690Packed"/>

Expand Down Expand Up @@ -544,19 +540,21 @@

<tdml:parserTestCase name="warning_exercise" root="int03"
model="SimpleTypes-Embedded.dfdl.xsd"
description="An error message should be generated - DFDL-2-012R">
description="A warning message should be generated - use of binaryNumperRep 'binary' with representation 'text'- DFDL-2-012R"
ignoreUnexpectedWarnings="false">

<tdml:document>
<tdml:documentPart type="byte">00000025</tdml:documentPart>
<tdml:documentPart type="text"> 37</tdml:documentPart>
</tdml:document>
<tdml:infoset>
<tdml:dfdlInfoset xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<int03 xsi:type="xs:int">37</int03>
</tdml:dfdlInfoset>
</tdml:infoset>
<tdml:warnings>
<tdml:warning /><!-- don't care what message is -->
<tdml:warning>binaryNumberRep</tdml:warning>
<tdml:warning>ignored</tdml:warning>
</tdml:warnings>
</tdml:parserTestCase>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@
<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:format ref="tns:GeneralPurposeFormat"
separatorSuppressionPolicy="trailingEmpty"
encodingErrorPolicy="replace"/>
separatorSuppressionPolicy="trailingEmpty"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@
<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:format ref="tns:GeneralPurposeFormat"
separatorSuppressionPolicy="trailingEmpty"
encodingErrorPolicy="replace"/>
separatorSuppressionPolicy="trailingEmpty"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ A general purpose defineFormat annotation.
<dfdl:format

encoding="UTF-8" utf16Width="fixed" byteOrder="bigEndian"
encodingErrorPolicy="replace"
encodingErrorPolicy="error"
ignoreCase="no" outputNewLine="%CR;%LF;"

alignment="1" alignmentUnits="bytes" fillByte="0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<xs:annotation>
<xs:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:format ref="tns:GeneralPurposeFormat" encodingErrorPolicy="replace"/>
<dfdl:format ref="tns:GeneralPurposeFormat"/>
</xs:appinfo>
</xs:annotation>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:format ref="fmt:GeneralPurposeFormat" encodingErrorPolicy="replace"/>
<dfdl:format ref="fmt:GeneralPurposeFormat"/>
</xsd:appinfo>
</xsd:annotation>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<xs:import namespace="http://www.ibm.com/dfdl/GeneralPurposeFormat"
schemaLocation="/IBMdefined/GeneralPurposeFormat.xsd" />
<dfdl:format ref="gpf:GeneralPurposeFormat" encodingErrorPolicy="replace" />
<dfdl:format ref="gpf:GeneralPurposeFormat" />
<xs:element name="basic" type="xs:string"
dfdl:lengthKind="delimited" />
</tdml:defineSchema>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

<tdml:defineSchema name="multipleDiscriminators">

<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormatPortable.dfdl.xsd"/>
<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>

<dfdl:format ref="ex:GeneralFormat" encodingErrorPolicy="replace" />
<dfdl:format ref="ex:GeneralFormat" />

<xs:element name="root">
<xs:complexType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ex="http://example.com"
xmlns:tns="http://example.com"
Expand Down Expand Up @@ -289,6 +290,7 @@
The decode will then fail with a parse error.
-->
<xs:element name="str" type="xs:string" dfdl:lengthUnits="bytes" dfdl:length="3"
daf:suppressSchemaDefinitionWarnings="ignoreDFDLProperty"
dfdl:alignment="8"/><!-- alignment will be ignored -->
</xs:sequence>
</xs:complexType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<tdml:testSuite 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:ex="http://example.com"
xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
defaultRoundTrip="true">


Expand Down Expand Up @@ -364,7 +365,8 @@
<xs:element name="a1" type="xs:string" dfdl:terminator=":" dfdl:lengthKind="explicit" dfdl:length="5" dfdl:encoding="ascii"
dfdl:lengthUnits="bytes" dfdl:alignment="8" dfdl:alignmentUnits="bytes" dfdl:leadingSkip="4" dfdl:trailingSkip="2"/>
<xs:element name="a2" type="xs:string" dfdl:initiator=":" dfdl:lengthKind="explicit" dfdl:length="5" dfdl:encoding="ascii"
dfdl:lengthUnits="bytes" dfdl:alignment="8" dfdl:alignmentUnits="bytes" dfdl:leadingSkip="4"/>
dfdl:lengthUnits="bytes" dfdl:alignment="8" dfdl:alignmentUnits="bytes" dfdl:leadingSkip="4"
daf:suppressSchemaDefinitionWarnings="alignmentAndInitiatorTextAlignmentNotCompatible"/>
</xs:choice>
</xs:complexType>
</xs:element>
Expand All @@ -376,7 +378,8 @@
<xs:complexType>
<xs:choice>
<xs:element name="a1" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="5" dfdl:encoding="ascii"
dfdl:lengthUnits="bytes" dfdl:alignment="4" dfdl:initiator=":" dfdl:alignmentUnits="bytes" dfdl:leadingSkip="4" dfdl:trailingSkip="2"/>
dfdl:lengthUnits="bytes" dfdl:alignment="4" dfdl:initiator=":" dfdl:alignmentUnits="bytes" dfdl:leadingSkip="4" dfdl:trailingSkip="2"
daf:suppressSchemaDefinitionWarnings="alignmentAndInitiatorTextAlignmentNotCompatible"/>
<xs:element name="a2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="5" dfdl:encoding="ascii"
dfdl:lengthUnits="bytes" dfdl:alignment="8" dfdl:terminator=":" dfdl:alignmentUnits="bytes" dfdl:leadingSkip="4"/>
</xs:choice>
Expand All @@ -393,7 +396,8 @@
<xs:complexType>
<xs:choice>
<xs:element name="a1" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="5" dfdl:encoding="ascii"
dfdl:lengthUnits="bytes" dfdl:alignment="4" dfdl:initiator=":" dfdl:alignmentUnits="bytes" dfdl:leadingSkip="4" dfdl:trailingSkip="2"/>
dfdl:lengthUnits="bytes" dfdl:alignment="4" dfdl:initiator=":" dfdl:alignmentUnits="bytes" dfdl:leadingSkip="4" dfdl:trailingSkip="2"
daf:suppressSchemaDefinitionWarnings="alignmentAndInitiatorTextAlignmentNotCompatible"/>
<xs:element name="a2" type="xs:string" dfdl:lengthKind="delimited" dfdl:encoding="ascii"
dfdl:alignment="8" dfdl:terminator=":" dfdl:alignmentUnits="bytes" dfdl:leadingSkip="4"/>
</xs:choice>
Expand Down Expand Up @@ -438,7 +442,7 @@
<xs:complexType>
<xs:sequence dfdl:separator="|">
<xs:element name="inner" type="xs:string" dfdl:initiator="(" dfdl:terminator=")" dfdl:alignmentUnits="bytes" dfdl:alignment="4" dfdl:lengthKind="delimited"
minOccurs="2" maxOccurs="2" dfdl:leadingSkip="2" dfdl:trailingSkip="4"/>
minOccurs="2" maxOccurs="2" dfdl:leadingSkip="2" dfdl:trailingSkip="4" daf:suppressSchemaDefinitionWarnings="alignmentAndInitiatorTextAlignmentNotCompatible"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
xmlns:ex="http://example.com"
xmlns:tns="http://example.com"
defaultRoundTrip="onePass">
Expand All @@ -34,10 +35,14 @@
<xs:element name="record" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence dfdl:separator=','>
<xs:element name="default1" type="xs:boolean" default="true" dfdl:textBooleanTrueRep="true" dfdl:textBooleanFalseRep="false" />
<xs:element name="default2" type="xs:boolean" default="false" dfdl:textBooleanTrueRep="true" dfdl:textBooleanFalseRep="false" />
<xs:element name="default3" type="xs:boolean" default="1" dfdl:textBooleanTrueRep="1" dfdl:textBooleanFalseRep="0" />
<xs:element name="default4" type="xs:boolean" default="0" dfdl:textBooleanTrueRep="1" dfdl:textBooleanFalseRep="0" />
<xs:element name="default1" type="xs:boolean" default="true" dfdl:textBooleanTrueRep="true" dfdl:textBooleanFalseRep="false"
daf:suppressSchemaDefinitionWarnings="noEmptyDefault"/>
<xs:element name="default2" type="xs:boolean" default="false" dfdl:textBooleanTrueRep="true" dfdl:textBooleanFalseRep="false"
daf:suppressSchemaDefinitionWarnings="noEmptyDefault"/>
<xs:element name="default3" type="xs:boolean" default="1" dfdl:textBooleanTrueRep="1" dfdl:textBooleanFalseRep="0"
daf:suppressSchemaDefinitionWarnings="noEmptyDefault"/>
<xs:element name="default4" type="xs:boolean" default="0" dfdl:textBooleanTrueRep="1" dfdl:textBooleanFalseRep="0"
daf:suppressSchemaDefinitionWarnings="noEmptyDefault"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,10 @@
</tdml:parserTestCase>

<tdml:defineSchema name="s2">
<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormatPortable.dfdl.xsd" />
<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd" />

<dfdl:format ref="ex:GeneralFormat"
lengthKind="delimited"
encodingErrorPolicy="replace"
useNilForDefault="no"/>

<xs:element dfdl:terminator="%NL;" name="r">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ex="http://example.com"
xmlns="http://example.com"
xmlns="http://example.com"
xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
xmlns:tns="http://example.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
defaultRoundTrip="true">
Expand All @@ -32,7 +33,8 @@
<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<dfdl:format ref="ex:GeneralFormat" lengthKind="delimited" occursCountKind="implicit"/>

<xs:element name="tnp01" type="xs:int" dfdl:textNumberRep="standard" dfdl:textStandardBase="16" dfdl:textNumberPattern="0000" />
<xs:element name="tnp01" type="xs:int" dfdl:textNumberRep="standard" dfdl:textStandardBase="16" dfdl:textNumberPattern="0000"
daf:suppressSchemaDefinitionWarnings="ignoreDFDLProperty"/>
<xs:element name="tnp02" type="xs:int" dfdl:textNumberRep="standard" dfdl:textNumberPattern=";0000" />
<xs:element name="tnp03" type="xs:int" dfdl:textNumberRep="standard" dfdl:textNumberPattern="0000;" />

Expand Down
Loading

0 comments on commit 2466eaf

Please sign in to comment.