W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2000

name vs. id

From: Jason Diamond <jason@injektilo.org>
Date: Thu, 9 Nov 2000 18:52:28 -0800
To: <xmlschema-dev@w3.org>
Message-ID: <LAEMKGDBDFAKFNKPFEKLGEDNCMAA.jason@injektilo.org>

I'm curious as to what the rationale was behind using the name attribute (on
the element, attribute, complexType, and simpleType elements) as the key for
referencing (via the ref, base, and type attributes).

A schema document's {type definitions}, {attribute declarations} and
{element declarations} properties only contain items declared at the top
(global) level. These are the only items that can be referenced. Since id is
required to be unique throughout the document, regardless of whether it's a
global or nested item, couldn't it be used instead to uniquely identify both
definitions and declarations?

This approach is not only more flexible (and not much more difficult to
implement) but also has the advantage that element declarations could be
included at the top level without artificially constraining it with
minOccurs="0" and maxOccurs="0" just so that you could reference it (if that
is indeed the case) from within multiple type definitions. Only
element/attribute declarations with a name would be part of the content

Type definitions wouldn't need a name which would (in my opinion) reduce the
confusion caused by multiple element and complexType elements who have name
attributes that only differ in the case of their first character.

I'm sure there's plenty of good technical reasons for why things were done
using name instead. Thanks in advance for pointing them out.

Received on Thursday, 9 November 2000 21:55:30 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:49 UTC