W3C

TAG Finding: Using QNames as Identifiers in Content

TAG Draft 04 Jun 2002

This version:
http://www.w3.org/2001/tag/doc/qnameids (HTML, XML)
Previous version:
http://www.w3.org/2001/tag/doc/qnameids-2002-04-30
Editor:
Norman Walsh, Sun Microsystems, Inc. <Norman.Walsh@Sun.COM>

Abstract

The question (see issue qnameAsId-18) that prompted this finding was "are QNames acceptable replacements for URIs as identifiers within specifications?" This finding documents the TAG's opinion on the use of QNames as identifiers.

Status of this Document

This document has been developed for discussion by the W3C Technical Architecture Group.

This document is the work of the editor. It is a draft with no official standing. It does not necessarily represent the consensus opinion of the TAG.

Comments may be directed to the W3C TAG mailing list www-tag@w3.org (archive).

Publication of this document by W3C indicates no endorsement by W3C or the W3C Team, or any W3C Members.

Table of Contents

1 QNames in XML
1.1 Colons in Other Contexts
2 QNames in Other Specifications
3 Architectural Observations
4 Architectural Recommendations
5 References


1 QNames in XML

Qualified names (QNames) were introduced by [XML Namespaces]. They were defined for element and attribute names (only) and provide a mechanism for concisely identifying a URI/localname pair.

When used solely in element and attribute names, all QNames are identified by the XML processor and can logically be replaced by the URI/localname pair they identify.

1.1 Colons in Other Contexts

At the request of the XML Schema Working Group, the XML Core Working Group is producing an erratum to [XML Namespaces] to clarify the meaning of colons in other contexts.

In particular, this erratum makes it clear that entity names, processing instruction targets, and notation names are not QNames and they may not include any colons. Documents that do not satisfy this constraint are not namespace well-formed. Furthermore, the values of attributes of type ID, IDREF(S), ENTITY(IES), and NOTATION are also forbidden from containing colons. Documents that do not satisfy this constraint are not namespace valid.

A colon that introduces a namespace validity or namespace well-formedness error into a document does not introduce a QName. In other words, the term "identifier" in this finding is not related to XML identifiers of type ID since they cannot be QNames.

2 QNames in Other Specifications

Other specifications, starting with [XSLT], have taken QNames and employed them in contexts other than element and attrbiute names. Specifically, QNames have been used in attribute values and element content.

In these contexts, QNames are most often used to identify a particular element type; they are, in principal, using QNames as they were intended.

It's possible that specifications will invent new uses for QNames as well, using them as shortcuts for unique identifiers derived from a URI/localname pair that have no relationship to element or attribute types.

3 Architectural Observations

The TAG makes the following observations:

4 Architectural Recommendations

The TAG recognizes that there are pragmatic reasons why it is desireable to provide the same kind of URI/localname shortcuts that QNames provide for element and attribute names in other contexts. In addition, the practice is already well established. Therefore, the TAG accepts that it is reasonable to use QNames in this way.

The TAG encourages designers to consider the ramifications of their use of QNames carefully. In particular, it makes the following recommendations.

  1. Specifications should not introduce QNames into mixed content or attribute values with untyped string content.

  2. Specifications should not use tokens that are syntactically QNames (that match the QName production) unless they are also semantically QNames.

  3. Specifications describing an XML language must not introduce new namespace declaration or scoping rules.

  4. Element or attribute values that contain a single QName should be declared with the xs:QName type.

5 References

XML Namespaces
Tim Bray, Dave Hollander, Andrew Layman, editors. Namespaces in XML. World Wide Web Consortium, 1999. (See http://www.w3.org/TR/REC-xml-names/.)
XSLT
James Clark, editor. XML Transformations (XSLT) Version 1.0. World Wide Web Consortium, 1999. (See http://www.w3.org/TR/xslt.)
XML Datatypes
Paul V. Biron and Ashok Malhotra, editors. XML Schema Part 2: Datatypes. World Wide Web Consortium, 2000. (See http://www.w3.org/TR/xmlschema-2/.)