W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2000

Re: name vs. id

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 10 Nov 2000 08:43:12 +0000
To: "Jason Diamond" <jason@injektilo.org>
Cc: <xmlschema-dev@w3.org>, www-xml-schema-comments@w3.org
Message-ID: <f5b8zqs6wv3.fsf@cogsci.ed.ac.uk>
"Jason Diamond" <jason@injektilo.org> writes:

> 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
> model.
> 
> 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.

I'm not sure I understand all your points.  The main reason we did
_not_ use an attribute of type ID to name elements, types, attributes
etc. is because that would have made it impossible to have e.g. a type 
and an attribute with the same name, which seemed to us unreasonably
constraining.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Friday, 10 November 2000 03:43:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:49 GMT