Re: Attribute declarations after complex type definitions

At 22:14 00/05/21 +0900, Martin J. Duerst wrote:
>This is a last call comment to XML Schema: Structures.
>
>Currently, all attribute-related stuff in an element
>decl. has to come after all content-related stuff.
>This seems not very well motivated and and definitely
>inconvenient, and should be changed to allow either
>complete mixture or having these both at the start and
>at the end (and just add those at the start and those at
>the end together), or if that's not possible, preferably
>at the start rather than at the end.
>
>It is more natural to have them at the start, because that's
>how they appear in the instance. DTD syntax made most people
>have attribute decl. after element content decls., but there
>is no need to do so for Schemas.

Thank you for the suggestion.  The WG has discussed this
issue, and I have been asked to respond to you with an
account of our discussion.  The WG will be asked later to
approve this response as representing its final disposition
of your comment (LC-190), but the wording and details of this
posting have not been approved by the WG and until that
happens I am, formally, speaking only for myself here.

It would indeed be possible to allow free intermixing of
attribute declarations and 'content model' declarations, at
least syntactically.  But, as you indirectly suggest, it
might be difficult to provide a simple, coherent semantics
for the interleaved form -- either the interleaving carries
some meaning (in which case what DOES it mean?) or else it
carries none.

The experience of DTD designers has been, in general, that
if there is no particular reason to choose between two
orders, or between an arbitrary fixed order and a free
order that has no significance, it is usually better to
choose a single fixed order arbitrarily than to allow
free ordering.  By hypothesis, the free ordering carries no
extra information, but it makes the job of parsers and
user interface designers harder.  So choosing a fixed order,
as is done in XML Schema, seems to us the correct choice.

Now the question become 'which order?', and here there is
both a factual point to make, and a judgement call.

Factually, we believe you are right that many DTD authors
follow the pattern of making an ATTLIST declaration immediately
follow the ELEMENT declaration for the relevant element.
But it is a mistake to believe that this sequence is required
by DTD syntax.  DTD syntax makes no such requirement; the
sequence ELEMENT, ATTLIST is not imposed by syntax, but 
chosen freely by DTD authors.

It appears to us (based partly on introspection by the DTD
authors in the WG, and partly on our knowledge of other
DTD designers) that many DTD authors have chosen this
sequence because it appears to them (though not, admittedly,
to you) more natural than the alternative.

So to the extent that there is a reason to choose between
the current sequence and the inverted sequence you propose,
the empirical evidence available to us seems to favor 
retaining our current choice.  It is worth mentioning, however,
that some members of the WG express a certain degree of
skepticism that judgments of 'naturalness' in questions like
this are at all reliable; such judgements, these WG members
contend, appear to be mutable, and to be based in the first
instance on experience with one sequence or the other, and
to a lesser extent on analogies with natural-language word
order (which itself pretty well destroys the notion that
any particular sequence is inherently more natural than
any other).

So the upshot is that while the WG is grateful for the
suggestion, we do not believe it would be an improvement
to the language.  We hope the paragraphs above provide 
an explanation of that decision sufficient to persuade you
to agree with us; let us know if you do (or don't).

Thank you.

Michael Sperberg-McQueen

Received on Wednesday, 21 June 2000 00:04:31 UTC