W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2016

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

From: David Ezell <David_E3@VERIFONE.com>
Date: Wed, 27 Jul 2016 13:59:02 +0000
To: Mukul Gandhi <gandhi.mukul@gmail.com>, Michael Kay <mike@saxonica.com>
CC: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <CY4PR03MB24879F6CFFCF350A7824F0ECC80F0@CY4PR03MB2487.namprd03.prod.outlook.com>
Hi Michael and Mukul:

I’ve been using XML schemas in standards development for more years than I like to admit, and this question seems to surface regularly.

It boils down to this statement:
* “Use <sequence/> when you want the elements in the defined specific order, AND when you don’t care about the order of the elements.”

Normally this leads to a puzzled look – why use <all/> then?
* “Use <all/> when the order that the elements appear has some >semantic< meaning – some value-add.”
(If each state in the US had a separate element name grouped by <all/>, and the states will appear in order of physical size.)

At some point <all/> was arguably more computationally expensive than <sequence/> - not sure about that any more – so using it >only< when there was some semantic conveyed by the ordering was good bandwidth stewardship.

Thank you both for continuing the discussion.

Best regards,

From: Mukul Gandhi [mailto:gandhi.mukul@gmail.com]
Sent: Wednesday, July 27, 2016 7:53 AM
To: Michael Kay
Cc: xmlschema-dev@w3.org
Subject: Re: a small document about XML Schema <sequence> vs <all> constructs

As usual Mike, your views are nice to know. My replies are inline please.

On 27 July 2016 at 13:07, Michael Kay <mike@saxonica.com<mailto:mike@saxonica.com>> wrote:
There are some cases where there clearly should be an order: in a table, the head comes before the body. (But why? Only because we are used to thinking of it that way. We could argue that this is purely a conventional way of presenting the table, and nothing to do with its semantics.)

I agree.

So from a usability perspective, it's a tough call, but one could probably say that imposing order makes things a little harder for authors and a little easier for readers.

I agree. This is a good point.

Note also that the human authors of this document have tended to be very consistent in the way attributes are ordered, even though the schema imposes no constraints. When, after a transformation, the dependency element reads  <dependency value="XQ31+" type="spec"/>, that really upsets the human reader.

This is a good point too. I think, as you said the schema imposes no constraints on attribute ordering (it cannot, because XML itself says that attribute ordering is not predictable).

In fact, that's why I added a serialization property to Saxon to allow you to control attribute order on output.

I think, this is something nice you've done with Saxon's XSLT processor.

If you're dealing with a vocabulary like GML that is never authored or read by humans, then these usability factors play no role, and it's even harder to find any good reason for deciding between sequence and all.

Thanks for telling about this, and I agree.

There is certainly a good argument for saying that if the ordering carries no semantic information, there is no case for the schema to impose an order.

Found it little harder to grasp meaning of this. But it is correct.

Mukul Gandhi
Received on Wednesday, 27 July 2016 13:59:51 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:16:11 UTC