Re: a small document about XML Schema <sequence> vs <all> constructs

On 28 July 2016 at 01:10, Ihe Onwuka <ihe.onwuka@gmail.com> wrote:

> but contrary to your write up sequence is not a subcase of xsd:all because
> xsd:all has severe cardinality restrictions in that it is limited to 0 or 1
> occurrence which would prohibit it's use even where unordered semantics are
> explicitly desired.
>

Thanks for this point. I had missed this within my document. Here's
something what the XML Schema specs say:

XML Schema 1.0
<all
  maxOccurs = 1 : 1
  minOccurs = (0 | 1) : 1

<sequence
<http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html#ID>
  maxOccurs = (nonNegativeInteger
<http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html#nonNegativeInteger>
| unbounded)  : 1
  minOccurs = nonNegativeInteger
<http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html#nonNegativeInteger>
 : 1

XML Schema 1.1
<all
<http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/datatypes.html#ID>
  maxOccurs = (0 | 1) : 1
  minOccurs = (0 | 1) : 1

<sequence
<http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/datatypes.html#ID>
  maxOccurs = (nonNegativeInteger
<http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/datatypes.html#nonNegativeInteger>
| unbounded)  : 1
  minOccurs = nonNegativeInteger
<http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/datatypes.html#nonNegativeInteger>
 : 1

I think, its an important difference between <xsd:all> and <xsd:sequence>
that, the entire <xsd:all> structure can't repeat more than once. But the
entire <xsd:sequence> structure can repeat more than once. But this doesn't
make <xsd:all> less useful (it still provides the unordered functionality,
but its structural expressiveness is restricted as compared to
<xsd:sequence>).



-- 
Regards,
Mukul Gandhi

Received on Thursday, 28 July 2016 05:05:45 UTC