A sequence having no children is syntactically legal in DFDL. In the data stream, such a sequence can have non-zero length LeftFraming and RightFraming regions, but the SequenceContent region in between must be empty. It is a processing error if the SequenceContent region of an empty sequence has non-zero length when parsing.
This leaves open the issue of hidden groups e.g., <sequence dfdl:hiddenGroupRef="mygroup"/> is an empty sequence? Or does the hidden group count as if there really are children of this sequence? I suspect the latter, but need to see how others have interpreted this.
XML schema does not define an empty sequence that is the content model of a complex type definition 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 model of a complex type, or if a complex type has nothing in its content model at all.
That makes clear that both these are SDE:
<complexType><sequence/></complexType>
<complexType></complexType>
But it leaves many scenarios unclear still.
Consider this schema fragment:
....
<choice>
<sequence dfdl:terminator=";"/>
<element name="foo"/>
</choice>
<element name="bar"/>
....
If we are unparsing and the infoset is just <bar> then we can compute
that finding <bar> in the infoset means the first branch is selected.
So we would unparse that and output a ";".
However, if there is true ambiguity like:
<choice>
<sequence dfdl:terminator=";"/>
<sequence dfdl:terminator="/"/>
<element name="foo"/>
</choice>
<element name="bar"/>
That's effectively saying on parse either a ";" or a "/"
may be found. On unparse, there is nothing to guide which choice branch
other than telling us if <bar> is found, that the <foo> element
branch is NOT selected. However, it is ok to just output the first always
(;) if the infoset has a <bar> element.
However, I wanted to check and see what others interpretation
of the spec is for this issue.
Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology
| www.tresys.com
Please note: Contributions to the DFDL Workgroup's email
discussions are subject to the OGF
Intellectual Property Policy
--
dfdl-wg mailing list
dfdl-wg@ogf.org
https://www.ogf.org/mailman/listinfo/dfdl-wg
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU