RE: Namespaces

Sean Mc Grath points out that the namespace problem recurrs in many
modern programming languages, and that these may give clues to a
solution.

Thank you.  I was very conscious of the IMPORT mechanism in Modula-2
when I proposed a solution to namespaces.  (You are also correct that
this is not a solution for sub-classing, an entirely different topic.)

Briefly, I and several other people looked at several possible ways to
create qualified names. Qualified names were an obvious requirement,
since having multiple namespaces obtain within a single element was
strongly demanded by several important user communities. It was equally
obvious that the web already has a mechanism for creating unique names,
specifically URIs.

*Syntax issues aside* (emphatically), here were the three front-runner
candidates:

1	The URI-at-the-front method:

	Every element name is qualified by putting the URI of its
namespace at the beginning, separated by something.  For example,
<http://purl.org/schemas#AUTHOR>William
Shakespeare</http://purl.org/schemas#AUTHOR>.
	This has obvious problems. Many of the URI characters are not
legal XML naming characters. Fragment identifiers have unreliable
semantics. Etc.	

2.	The "Java" method:

	Use a form of indirection, in which a namespace is known
throughout the document by an identifier that is a legal XML name, but
that name is somehow associated with the controlling URI. In the "Java"
method, the XML-legal identifier is inside the DTD (or other document
defining the namespace).

	<sometag>
		<IMPORT>http://www.purl.org/schemas</IMPORT>	<!--
Somehow associates "xyzzy" with this namespace. -->
		<xyzzy:AUTHOR>William Shakespeare</xyzzy:AUTHOR>
	</sometag>

	This is essentially number one, but without the illegal
character problem. However, it now requires that the defining document
be modified to contain the namespace name ("xyzzy").  Worse, it requires
that the document be machine-readable in a predefined format, and many
important schemata, such as Dublin Core, are not machine readable and
will not be for years. That is, it mixes the problem of identifying
namespaces with the problem of their defining document's format.
("Author" in the example above actually comes from the Dublin Core, a
text document.) Finally, it doesn't really solve the namespace problem,
it just moves it up a level. We still have to somehow manage that no two
namespaces ever use the same name (e.g. "xyzzy").

3.		The "Modula-2" method:

	Use a form of indirection, in which a namespace is known
throughout the document by an identifier that is a legal XML name, but
that name is somehow associated with the controlling URI. In the
"Modula-2" method, the XML-legal identifier is inside the referencing
document.

	<sometag>

<IMPORT><REF>http://www.purl.org/schemas</REF><AS>xyzzy</AS></IMPORT>
		<xyzzy:AUTHOR>William Shakespeare</xyzzy:AUTHOR>
	</sometag>

	This simply references a namespace, without any requirements of
the format (even existence!) of the defining document. The user of the
namespace is responsible for picking a local name, subject only to the
requirement that it is unique within the scope of his local use.


	--Andrew Layman
	AndrewL@microsoft.com 

Received on Thursday, 22 May 1997 12:08:02 UTC