[ 
https://issues.apache.org/jira/browse/DAFFODIL-669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17911976#comment-17911976
 ] 

Steve Lawrence commented on DAFFODIL-669:
-----------------------------------------

Note that in some cases it may be useful to have a complex type with an empty 
sequence (e.g. for skipping bits). The workaround for this is to add an second 
inner sequence, e.g.:

{code:xml}
<xs:element name="foo" ...>
  <xs:complexType>
    <xs:sequence>
      <xs:sequence />
    </xs:sequence>
  </xs:complexType>
</xs:element>
{code}

When this bug is fixed, we should add tests to make sure this workaround still 
works.

> SDE should occur when empty sequence is the content of a complexType
> --------------------------------------------------------------------
>
>                 Key: DAFFODIL-669
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-669
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Front End
>            Reporter: Jessie Chab
>            Priority: Minor
>              Labels: beginner
>
> According to the spec:
> XML schema does not define an empty sequence that is the content of a complex 
> type as effective content so any DFDL annotations on such a construct would 
> be ignored. It is a schema definition error if the empty sequence is the 
> content of a complex type.
> I set this up in test emptySequenceSDE, but there is no error:
> [info] - test_emptySequenceSDE *** FAILED ***
> {color:red}[info]   java.lang.Exception: Expected error. Didn't get one. 
> Actual result was <emptySeq></emptySeq>
> {color}
> [info]   at 
> edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runParseExpectErrors(TDMLRunner.scala:479)
> [info]   at 
> edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runProcessor(TDMLRunner.scala:402)
> [info]   at edu.illinois.ncsa.daffodil.tdml.TestCase.run(TDMLRunner.scala:350)
> [info]   at 
> edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTestWithDataVolumes(TDMLRunner.scala:222)
> [info]   at 
> edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTest(TDMLRunner.scala:213)
> [info]   at 
> edu.illinois.ncsa.daffodil.section14.sequence_groups.TestSequenceGroups.test_emptySequenceSDE(TestSequenceGroups.scala:77)
> [info]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [info]   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> [info]   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [info]   at java.lang.reflect.Method.invoke(Method.java:601)
> The test is emptySequenceSDE in the following files:
> daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section14/sequence_groups/SequenceGroup.tdml
> daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section14/sequence_groups/TestSequenceGroupsDebug.scala
> daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section14/sequence_groups/TestSequenceGroups.scala



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to