You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@daffodil.apache.org by "Costello, Roger L." <co...@mitre.org> on 2019/09/23 21:15:17 UTC
Contradictory statements about empty sequences?
[cid:image001.png@01D57232.77A8CC60]
Re: Contradictory statements about empty sequences?
Posted by "Beckerle, Mike" <mb...@tresys.com>.
Clear as mud eh?
I think this is a spec bug.
The first paragraph is referring to a sequence which is XSD-wise empty, but may carry DFDL annotations:
<xs:sequence dfdl:initator="A" dfdl:terminator="B"/>
That's seemingly a perfectly fine way to require an AB in the data stream.
The statement "It is a processing error if the SequenceContent region of an empty sequence has non-zero length when parsing." is a very weird sentence. I think it is saying that in the above, if you find A in the data stream, and then find content before you find B, that's an error.
Personally I think it goes without saying to me that there's nothing in the sequence so there must be no data corresponding to that. The data grammar makes this clear, so I think the phrasing is misleading as is.
Perhaps we should just rephrase that to
"A sequence with no content (no children other than annotations) can still have non-zero length framing regions."
The latter paragraph you cited is about how to XSD this is not "effective content".
<xs:element ....>
<xs:complexType>
<xs:sequence/> <!-- not effective content -->
</xs:complexType>
</xs:element>
See: https://www.w3.org/TR/xmlschema-1/#Complex_Type_Definition_details
and search for "effective content".
So what you have found is a spec bug I think.
I don't see the statement that it is "not effective content" here, what I see is that the above would be considered an element of complex type with empty content.
The DFDL Spec explicitly allows complexType elements with empty content. Says so in the glossary and elsewhere.
So I don't get why DFDL doesn't allow:
<xs:element ....>
<xs:complexType>
<xs:sequence/> <!-- not effective content -->
</xs:complexType>
</xs:element>
Even though that inner sequence might contain dfdl annotations.
I.e., This is not legal DFDL:
<xs:element name="checkDescrim">
<xs:complexType>
<xs:sequence>
<xs:annotation><xs:appinfo ...>
<dfdl:discriminator>..check something ...</dfdl:discriminator>
</xs:appinfo></xs:annotation>
</xs:sequence>
</xs:complexType>
</xs:element>
Disallowed, but I'm not sure why.
This restriction seems entirely silly to me as the workaround is *trivial*. Just wrap the sequence in another sequence. Now the sequence that is the content of the complexType is not empty any more.
<xs:element ....>
<xs:complexType>
<xs:sequence>
<xs:sequence>
<xs:annotation><xs:appinfo ...>
<dfdl:discriminator>..check something ...</dfdl:discriminator>
</xs:appinfo></xs:annotation>
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
That's allowed in DFDL.
________________________________
From: Costello, Roger L. <co...@mitre.org>
Sent: Monday, September 23, 2019 5:15 PM
To: users@daffodil.apache.org <us...@daffodil.apache.org>
Subject: Contradictory statements about empty sequences?
[cid:image001.png@01D57232.77A8CC60]