Archive of UserLand's first discussion group, started October 5, 1998.

Re: xml namespaces

Author:Chris Olds
Posted:6/29/2000; 8:37:47 PM
Topic:xml namespaces
Msg #:18288 (In response to 18263)
Prev/Next:18287 / 18289

Dave Winer <dave@userland.com> wrote:

On Scripting News yesterday I said: "I don't like namespaces. This is based on my own confusion when I see all those esoteric labels all over XML documents. I've been very clear about this all along."

Namespaces are a solution to a specific problem: how does one mix a fixed (known) tag set with an arbitrary set of tags?

This is the only problem that namespaces are the best solution for. All of the talk about how namespaces are a good way to create mix-n-match vocabularies is bunk (IMHO, obviously). In order to process such a doument, the processing software must have some idea of how to process (or equivalently, fetch) the semantics of at least one of the namespaces. There is nothing in the namespaces REC that makes processing (or creating) mixed-name documents easier; that is a hard problem, and there are already good solutions for making it easier (all from HyTime; <http://www.oasis-open.org/cover/hytime.html> is a good starting point); principally SGML Architectural Forms and Groves.

So why was it critical to have a Namespaces REC? Because without one, you can't do XSL or RDF (actually, the XML serialization of RDF, but who's counting...) or XML schemata using XML syntax. The first thing I discovered when I wrote my first stylesheet language was that there were no safe names to use for the tags enclosing the stylesheet elements. If I wanted to use XML to define both the stylesheet and the data being processed, I would have to either make some tag names off-limits or allow the names used by the stylesheet language to be configurable (by some separate mechanism, obviously (or the problem recurses)).

RDF is only slightly different, in that it is expected that processing software would understand the RDF: namespace (which allows graph-building, even without interpretation) and one or more of the instance namespaces (e.g. Dublin Core), which would be processed according to the needs of the RDF-comsuming application. XML Schema (part 1 - Structures) uses namespaces to avoid 'capturing' names, but any schema constraints that a general-purpose schema processor are ultimately defined in terms of the core Schema schema.

So, are namespaces ugly? Yes, I think so. Can we do without them? Absolutely not. They are an important enabler for general-purpose software (which must, of necessity, process a fixed vocabulary). Composing documents that validate against multiple constraint sets (DTDs or Schemata) is hard. Namespaces do not make that any easier, because all they do (all they are intended to do, if you read the REC) is to keep names from colliding. When is this useful? When one needs to mix a fixed vocabulary with arbitrary XML data (e.g., XSL, RDF) or when one needs to be able to extend a base vocabulary (e.g., XML Schemas).

/cco




This page was archived on 6/13/2001; 4:55:33 PM.

© Copyright 1998-2001 UserLand Software, Inc.