TAG Finding: Using Qualified Names (QNames) as Identifiers in Content

I have just read this [1], thanks to Dave Pawson who drew it to my
attention.

The document takes a reasonably pragmatic approach, recognizing that the
horse has already bolted and it's too late to lock the door.

I think that identifying QNames using the schema type xs:QName is a very
partial solution, as the document notes, it fails to catch many cases
where QNames (or more generally, namespace prefixes) are used in element
and attribute content.

A more powerful approach would be for XML Schema to introduce a boolean
facet, "uses-namespace-prefixes", which could be attached to any value
that depends on the namespace context. This still doesn't fix the whole
problem, of course, because when copying such a value you still don't
know precisely which namespaces it depends on, so you have to copy them
all, just in case. But at least it would indicate that copying the value
without the namesapce context is unsafe, as is changing namespace
prefixes.

Another way of mitigating the problem is to define a lexical
representation of the value space of QNames, for example the form
"{namespace-uri}local-name", that is independent of the namespace
declaration context. (The above form has been adopted in the Java JAXP
interface.) If this form were accepted in any context where a QName is
allowed (including perhaps even XML element and attribute names!) many
of the problems of context-dependency could be solved more easily, for
example this could form the basis of a context-free syntax for XPath
expressions.

Michael Kay

[1] http://www.w3.org/2001/tag/doc/qnameids

Received on Tuesday, 9 July 2002 05:12:23 UTC