W3C home > Mailing lists > Public > xml-uri@w3.org > May 2000

Re: Attribute uniqueness test: a radical proposal

From: David Carlisle <david@dcarlisle.demon.co.uk>
Date: Sun, 28 May 2000 12:48:05 +0100 (BST)
Message-Id: <m12w1Y5-000OdEC@dcarlisle.demon.co.uk>
To: abrahams@acm.org
CC: XML-uri@w3.org

> cite as vital is, I agree, vital -- but it's addressed by XSLT, not by
> the namespace spec.

No. Absolutely not.
the namespace rec's motivation is, and I quote

... document constructs should have universal names, whose scope
extends beyond their containing document. This specification describes
a mechanism, XML namespaces that accomplishes this.

So, in other words, defining what x:xxx means in a way that is
consistent in both the document and the stylesheet is the _only_
purpose of the namespace spec. I can't see how you could possibly
argue otherwise.

The only place where comparison is explictly mentioned in the document
is in the attribute test but that is because the rec has to define
namespace conforming documents and that test is required so that
documents after being parsed conform to the well formed constraint
unique att spec of XML 1.0. Other places where comparison of names
occurs in XML 1.0 (eg that start and end tags have same name) is
covered in XML namespaces by reference to XML 1.0.

XML namespaces does not try to change the underlying document model
of XML 1.0 which is that elements are essentially ordered, and
attributes are essentially unordered, and thus need to be specified at
most once on any given element. The only difference is that where
XML names are a flat string, XML Namespace names are a structured pair
consisting of a namespace name and a local name. The prefix syntax
is just  some surface syntax (the rec calls it  a proxy) to get round
the fact that you can't have a notation which makes the structured
name explicit in XML 1.0 conforming syntax.

So if x: and y: are bound to the same namespace  x:x="1" and y:x="2"
are two settings of the same attribute to different values. It makes
no more sense than saying that you should allow 
x="1" and x='2' in the same element start tag, as they use different
quote forms so can be distinguished.
Certainly in my own namespace processor, if the namespace rec was
changed to drop this restriction that an attribute could appear more
than once I would have to completely re-write it, it is built
assuming that an attribute only is used once (and it really doesn't
keep the prefix information, that is lost at the same time that
the " ' distinction or white space around the = is lost.

If x: and y: were bound to a namespace in the document and z: was
bound to the same namespace in the stylesheet

then given 

<xxxx  x:x="1" and y:x="2"/>

in the document what would you want 

<xsl:value-of xxxx/@z:x />

to be?

> Can you give an example showing how a
> document that is well-formed according to the modified uniqueness test
> is turned into a document that is not well-formed?

Yes, the above document, to a namespace parser has the same element
attribute structure as

<xxxx  x:x="1" and x:x="2"/>

but this isn't well formed XML.

While namespaces were being discussed on xml-dev there were proposals
that already at the level of sax it would be the case that the
prefix info was dropped. In fact a sax2 parser will keep some other
information about names, and about entity references and other stuff
but that is essentially extra info not forced by the model.
As I say, if x: and y: are bound to the same prefix then my own system
will produce exactly the same internal structure for these two
<xxxx  x:x="1" and y:x="2"/>
<xxxx  x:x="1" and x:x="2"/>
which actually is unspecified behaviour since the second isn't well
formed XML.

>  there may still be a conflict because of an
> undetected equivalence.

The namespace rec is explictly written so that undetected equivalence
can not occur. Any change to the rec that changes this is completely
utterly broken.

If I need to define two namespaces to use in some document then I can use
http://www.dcarlisle.demon.co.uk
and
HTTP://WWW.DCARLISLE.DEMON.CO.UK

it is _not_ at the liberty of some consumer of the document to decide
that it understands DNS names and URI scheme sufficiently that it
can decide the namespaces are equivalent. If I'd wanted to use the
same namespace in both cases, I would have done so. The fact that
I pay to have that URI name work means that I can generate 2^30
or so similar namespace names if I so wish, and none of them will
(or should) clash with anyone else's namespace names.

> I cut the knot by saying that the namespace spec should be silent on the
> subject,

How can it be silent on the subject that it says is its only reason
for existence?

David
Received on Sunday, 28 May 2000 07:44:14 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:32:43 UTC