Re: ID and NAME

On 25 Sep 1997, Peter Flynn wrote:

> MZ writes:
>    I know ID and NAME occupy the same namespace.
> 
> I thought the whole point about NAME was that it _didn't_ occupy
> the same namespace as ID. Unless someone's changed it recently.
> ID is declared as ID; NAME is CDATA last time I looked.
> 
>    <A NAME="fubar" ID="fubar">...
> 
> Perfectly OK, precisely because they _don't_ occupy the same
> namespace.

If you want to be exact, their namespaces overlap, for historical
reasons. It's impossible to declare ID as CDATA in SGML. However,
NAME has quite some deployed use with values other than those
very restricted ones allowed for ID. Also, ID is, from an SGML
viewpoint, case-insensitive (i.e. FUBAR would be the same as
fubar and FuBaR,...), where NAME traditionally and in all major
implementations is case-sensitive (shorter code :-).

This, together with the problems that case-sensitivity does not
easily scale in an international setting (German sz, Turkish
dotless i,...), let to the solution that:

- The namespaces are merged (but you can have names in NAME
	that you can't in ID)
- The names are case-sensitive (i.e. case matters)
- It is not allowed/suggested to use names that only differ
	in case, because this might give bad surprises
	(an SGML validator interprets them as being the same,
	and so barks if one element is ID=fubar and the other
	is ID=FUBAR, but some other application may find it
	fine).

That pretty much allows everybody to be happy :-).


Regards,	Martin.

Received on Friday, 26 September 1997 07:49:37 UTC