Namespaces

Ronald Bourret rbourret at ito.tu-darmstadt.de
Thu Feb 4 11:12:01 GMT 1999


Oren Ben-Kiki wrote:

> Is it possible to recast the namespace recommendation as a transformation
> from an XML tree with 'xmlns' attributes and '...:' prefixes into a tree
> which doesn't have them, but with modified element and attribute names, 
such
> that the semantics of the resulting tree under the rest of the relevant
> recommendations (ignoring namespaces) is preserved? One would of course 
have
> to pass the DTDs (or other schema files) through the same transformation.

This transformation is possible, but I don't think it buys you anything. 
 If the transformation results in locally unique names, you break 
applications, since these can no longer recognize the locally unique names, 
which potentially change each time a document is processed.  If it results 
in globally unique names, you could rewrite the applications to recognize 
these names, but you aren't really gaining anything over current namespace 
processing.

> If this isn't possible, and from what I'm reading this seems a real
> possibility, then I'd like to know the details - in particular, I want to
> hear the advantages gained by this decision. Is it some attempt to mix
> together namespaces and other issues - such as mixed content, combining
> documents, extending DTDs, etc.? MVHO is that such issues should be 
solved
> separately of the unique naming issue, but I realize that the W3C has a
> tradition of mixing together issues which seem separate to me :-)

Mixed content, combining documents, extending DTDs, etc. are not directly 
addressed by the namespaces spec, nor does the spec claim to solve them. 
 They are closely tied because all of these need namespaces in order to be 
solved.  This is generally where confusion in the namespaces spec comes 
from -- the hope that the namespaces spec directly addresses these issues 
and the confusion when the reader finally realizes that in "only" gives a 
syntax for a two-part naming system.

> > However, if I was forced to answer, I would say that the relationship
> > was not the same.

For those of you who have forgotten the original question (I had to look it 
up), it essentially asks:

Is the relationship between "good" and "a" the same in <good a="1"/> and 
<good foo:a="1"/>?

> These two statements seem contradictory to me - if "all" the namespaces 
do
> is prefix the names with a URI, why should the relationship between 
expanded
> names be different then that between "normal" names? If this relationship 
is
> "application defined" for normal names (as James implies), then doesn't 
it
> remain "application defined" when the names are expanded? Anyway, how 
come
> it is "application dependent" - don't DTDs and schema language have a lot 
to
> say about it?

Expansion has nothing to do with it.  The namespaces spec introduces the 
concept of a "global" attribute, which doesn't exist in XML 1.0.  (For a 
discussion of global attributes, see Andrew Layman's summary at 
http://www.lists.ic.ac.uk/hypermail/xml-dev/9902/0027.html.)

You can tell which attributes are global and which are local by looking for 
prefixes: global attributes have a prefix and local attributes don't. 
 Another characteristic is that global attributes are in a different 
(traditional) namespace than local attributes.  That is, global attribute 
names must be unique among all global attribute names in the document, 
while local attribute names must be unique among all local attributes in 
each element.  Because the (traditional) namespaces of local and global 
attributes do not overlap, so you can have a global attribute that has the 
same name as a local attribute.  That is, the following is legal:

<good a="1" foo:a="1"/>

So, your question boils down to: "Is the relationship of good to a the same 
as the relationship of good to foo:a?"  James rightly side-steps the 
question, because you are asking about the relationship between an element 
and two *different* attributes which *happen* to have the same name.  This 
question has nothing to do with the namespaces spec (how the names of these 
attributes are expressed -- prefix form, Clark notation, etc. -- is 
irrelevant), but with the actual, application-defined semantics of the 
attributes.  James then guesses that they are probably different and goes 
on to explain why.

Does your head hurt any less now?

-- Ron Bourret


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list