mbeckerle commented on code in PR #898:
URL: https://github.com/apache/daffodil/pull/898#discussion_r1054494512
##########
daffodil-test/src/test/resources/org/apache/daffodil/usertests/MultipartBody.dfdl.xsd:
##########
@@ -54,7 +54,7 @@
<xsd:element name="BodyPart"
dfdl:lengthKind="delimited"
minOccurs="1" maxOccurs="unbounded"
type="xsd:string"
dfdl:occursCountKind="implicit"
- dfdlx:emptyElementParsePolicy="treatAsEmpty" />
+ dfdl:emptyElementParsePolicy="treatAsEmpty" />
Review Comment:
Indentation in this file is totally goofed up. Rather than fix it, and have
whitespace fixing be part of this PR, let's accumulate whitespace fixups on a
ticket.
I already added this file to this ticket:
https://issues.apache.org/jira/browse/DAFFODIL-2759
##########
daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml:
##########
@@ -334,7 +325,7 @@
</tdml:infoset>
</tdml:parserTestCase>
- <tdml:parserTestCase name="test_sep_ssp_never_4" root="file2" model="s4"
+ <tdml:parserTestCase name="test_sep_ssp_never_4_ibm" root="file2" model="s4"
implementations="ibm">
<tdml:document>madonna,,,,,,,,,</tdml:document>
<!--
Review Comment:
I hate it when github won't let me put a comment on the line I want to. They
have, in their infinite wisdom, descided that if you didn't change a line or
the line isn't close enough to a change, no comment is allowed.
Below a tdml:error is expecting 'treatAsMissing'. I believe this should
change, per the comment, now.
##########
daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml:
##########
@@ -278,15 +274,11 @@
<xs:include
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<dfdl:format
- ref="ex:GeneralFormatPortable"
- representation="text"
- lengthKind="delimited"
- separatorPosition="infix"
- dfdlx:emptyElementParsePolicy="treatAsMissing"/> <!-- remove extension
proerty for IBM cross tests -->
- <!--
- Note: dfdlx:emptyElementParsePolicy should become regular DFDL
emptyElementParsePolicy
- once implemented in DAFFODIL-2496. The enum 'treatAsMissing' is renamed to
'treatAsAbsent'
- -->
+ ref="ex:GeneralFormatPortable"
+ representation="text"
+ lengthKind="delimited"
+ separatorPosition="infix"
+ dfdlx:emptyElementParsePolicy="treatAsMissing"/> <!-- remove
extension property for IBM cross tests -->
Review Comment:
Should this be just no-prefix emptyElementParsePolicy='treatAsAbsent' now?
I probably wrote this test originally, but I don't understand the comment
"remove extension property for IBM cross tests" since this is used by an IBM
cross test below. It must be that IBM DFDL is able to ignore the dfdlx
extensions or this wouldn't have worked in test test_sep_ssp_never_4_ibm.
So I think the comment line "remove extension property for IBM cross tests"
is spurious now.
##########
daffodil-lib/src/main/scala/org/apache/daffodil/schema/annotation/props/ByHandMixins.scala:
##########
@@ -432,7 +432,9 @@ sealed trait EmptyElementParsePolicy extends
EmptyElementParsePolicy.Value
object EmptyElementParsePolicy extends Enum[EmptyElementParsePolicy] {
case object TreatAsMissing extends EmptyElementParsePolicy
case object TreatAsEmpty extends EmptyElementParsePolicy
- override lazy val values = Array(TreatAsMissing, TreatAsEmpty)
+ case object TreatAsAbsent extends EmptyElementParsePolicy
+
+ override lazy val values = Array(TreatAsMissing, TreatAsEmpty, TreatAsAbsent)
def apply(name: String, context: ThrowsSDE): EmptyElementParsePolicy =
stringToEnum("emptyElementParsePolicy", name, context)
Review Comment:
We should re-enable this warning, yes. Making the property required right
now would break people's schemas.
We do need to also add this property to DFDLGeneralFormat, with value
treatAsEmpty. But this may need to be in Daffodil-only part of that if IBM DFDL
doesn't tolerate the property.
##########
daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml:
##########
@@ -278,15 +274,11 @@
<xs:include
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<dfdl:format
- ref="ex:GeneralFormatPortable"
- representation="text"
- lengthKind="delimited"
- separatorPosition="infix"
- dfdlx:emptyElementParsePolicy="treatAsMissing"/> <!-- remove extension
proerty for IBM cross tests -->
- <!--
- Note: dfdlx:emptyElementParsePolicy should become regular DFDL
emptyElementParsePolicy
- once implemented in DAFFODIL-2496. The enum 'treatAsMissing' is renamed to
'treatAsAbsent'
- -->
+ ref="ex:GeneralFormatPortable"
+ representation="text"
+ lengthKind="delimited"
+ separatorPosition="infix"
+ dfdlx:emptyElementParsePolicy="treatAsMissing"/> <!-- remove
extension property for IBM cross tests -->
<!--
treatAsMissing should have no effect here, because everything is optional.
Review Comment:
change comment to 'treatAsAbsent'.
##########
daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml:
##########
@@ -304,7 +296,6 @@
<!-- Same, but has minOccurs=maxOccurs for the arrays.
That makes all array elements "required"
-
treatAsMissing causes this to fail. Required empty non-defaultable is an
error in that case.
Review Comment:
change comment to treatAsAbsent, and remove parenthetic note about fixing
2496.
##########
daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml:
##########
@@ -349,5 +340,73 @@
</tdml:errors>
</tdml:parserTestCase>
+ <tdml:parserTestCase name="test_sep_ssp_never_4_daffodil" root="file2"
model="s4"
+ implementations="daffodil">
+ <tdml:document>madonna,,,,,,,,,</tdml:document>
+ <tdml:warnings>
+ <tdml:warning>emptyElementParsePolicy is deprecated</tdml:warning>
+ <tdml:warning>Use dfdl:emptyElementParsePolicy</tdml:warning>
+ </tdml:warnings>
+ <tdml:errors>
+ <tdml:error>Parse Error</tdml:error>
+ <tdml:error>Empty element not allowed</tdml:error>
+ <tdml:error>required</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <!--
+ This schema identical to s3, except for the emptyElementParsePolicy is
treatAsAbsent
+ -->
+ <tdml:defineSchema name="s5" elementFormDefault="unqualified">
+
+ <xs:include
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:format
+ ref="ex:GeneralFormatPortable"
+ representation="text"
+ lengthKind="delimited"
+ separatorPosition="infix"
+ emptyElementParsePolicy="treatAsAbsent"/>
+
+ <!--
+ treatAsAbsent should have no effect here, because everything is optional.
+ -->
+ <xs:element name="file1">
+ <xs:complexType>
+ <xs:sequence dfdl:separator="," dfdl:separatorPosition="infix"
+ dfdl:separatorSuppressionPolicy="never">
+ <xs:element name="given-name" type="xs:string" minOccurs="0"
maxOccurs="3"/>
+ <xs:element name="surname" type="xs:string" minOccurs="0"/>
+ <xs:element name="phone" type="xs:string" minOccurs="0"
maxOccurs="6"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Same, but has minOccurs=maxOccurs for the arrays.
+ That makes all array elements "required"
+
+ treatAsAbsent causes this to fail. Required empty non-defaultable is an
error in that case.
+ -->
+ <xs:element name="file2">
+ <xs:complexType>
+ <xs:sequence dfdl:separator="," dfdl:separatorPosition="infix"
+ dfdl:separatorSuppressionPolicy="never">
+ <xs:element name="given-name" type="xs:string" minOccurs="3"
maxOccurs="3"/>
+ <xs:element name="surname" type="xs:string"/>
+ <xs:element name="phone" type="xs:string" minOccurs="6"
maxOccurs="6"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ </tdml:defineSchema>
+
+ <tdml:parserTestCase name="test_sep_ssp_never_5" root="file2" model="s5"
+ implementations="daffodil">
+ <tdml:document>madonna,,,,,,,,,</tdml:document>
+ <tdml:errors>
+ <tdml:error>Parse Error</tdml:error>
+ <tdml:error>Empty element not allowed</tdml:error>
+ <tdml:error>required</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
</tdml:testSuite>
Review Comment:
While you are at it, add a final new-line.
--
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]