W3C

xml:id Version 1.0

W3C Working Draft 7 April 2004

This version:
http://www.w3.org/TR/2004/WD-xml-id-20040407
Latest version:
http://www.w3.org/TR/xml-id/
Editors:
Jonathan Marsh, Microsoft <jmarsh@microsoft.com>
Daniel Veillard, Invited Expert <daniel@veillard.com>

This document is also available in these non-normative formats: XML.


Abstract

This document unreserves the attribute xml:id as a universal spelling for ID attributes, and defines processing of this attribute to identify IDs in the absence of validation.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document is a Working Draft of the W3C. This document has been produced by the W3C XML Core Working Group as part of the XML Activity, based on the XML id (member only) Working Draft produced by the HTML Working Group. Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This First Public Working Draft documents the progress made to date in attempting to satisfy the requirements set in the xml:id Requirements Working Draft published on 6 August 2003.

It should be noted that this first Working Draft does not yet fully address specific interactions between this specification and others. The intent is for this specification to compose smoothly with other specifications, but some specifications (particularly those not based on the XML Information Set) may require errata to realize the full benefits of xml:id. These interactions are a topic of study by the Working Group and will be documented in future Working Drafts.

The public is invited to send comments to the public mailing list public-xml-id@w3.org (archive).

This document has been produced under the 24 January 2002 CPP as amended by the W3C Patent Policy Transition Procedure. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) with respect to this specification should disclose the information in accordance with section 6 of the W3C Patent Policy. Documentation of intellectual property possibly relevant to this specification may be found at the Working Group's public IPR disclosure page.

Table of Contents

1 Introduction
2 Terminology
3 Syntax
4 Usage
4.1 With DTD Validation
4.2 With XML Schema Validation
4.3 Behaviour when no xml:id declaration is available
4.3.1 Using the attribute type infoset property
4.3.2 Using the type definition family of properties respectively.
5 Conformance
5.1 XML Information Set Conformance

Appendices

A References
B References (Non-Normative)
C Impacts on other Standards (Non-Normative)
D Open Issues (Non-normative)


1 Introduction

[XML 1.0] provides a mechanism for annotating elements with unique identifiers. This mechanism consists of declaring the type of an attribute as "ID", after which the parser will validate that the ID value matches the allowed lexical form, that the value is unique within the XML document, and that each element has a single unique identifier. To declare IDs within an XML document, one need only provide an internal or external subset containing such a declaration. However, processing of this information if present in the external subset is optional for conformant XML processors, leaving no guarantee that all consumers of the XML document will be able to successfully recognize the identifiers.

Identifiers can be declared through external mechanisms as well. Of particular interest is [XML Schemas] which provides a type "xs:ID" with the same uniqueness and validity constraints as XML does. However, there are no guarantees that consumers will have the "correct" schema available, nor that they will process it if they do.

A mechanism allowing unique element identifiers to be recognized by all conformant XML processors, whether they validate or not, is desirable in making XML sub-resource linking robust.

An additional problem is that DTD-based and XML Schema-based identifiers are exposed through different conceptual mechanisms - the [attribute type] infoset property, and the [type definition] family of properties respectively. A uniform mechanism for recognizing identifiers is desirable.

2 Terminology

[Definition: The key words must, must not, required, shall, shall not, should, should not, recommended, may, and optional in this specification are to be interpreted as described in [IETF RFC 2119].]

3 Syntax

This specification unreserves the attribute "xml:id" for use as a common syntax for identifiers in XML. Authors of XML documents are encouraged to name their ID attributes "xml:id" to increase the interoperability of these identifiers on the Web.

In namespace-aware XML processors, the "xml" prefix is bound to the namespace name http://www.w3.org/XML/1998/namespace as described in Namespaces in XML [Namespaces in XML]. Note that xml:id can be still used by non-namespace-aware processors.

4 Usage

4.1 With DTD Validation

DTD authors are encouraged to exclusively use xml:id in their DTDs to indicate element identifiers.

The following (non-normative) DTD fragment illustrates a sample declaration for the xml:id attribute:

<!ATTLIST someElement
    xml:id     ID          #IMPLIED
>

DTD authors should not declare xml:id as something other than ID (for instance CDATA) for interoperability with XML Schema- and non-validating processors. DTD authors should not declare attributes other than xml:id as type ID for interoperability with XML Schema- and non-validating processors. No interoperability guarantees are provided in these cases.

Validating consumers of documents using properly declared xml:id attributes can recognize IDs through the [attribute type] property.

4.2 With XML Schema Validation

XML Schema authors are encouraged to exclusively use xml:id in their schemas to indicate element identifiers.

The following (non-normative) XML Schema fragment illustrates a sample declaration for the xml:id attribute:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.w3.org/1998/XML/Namespace">

    <xs:attribute name="xml:id" type="xs:ID"/>

</xs:schema>

XML Schema authors should not declare xml:id as something other than xs:ID (for instance xs:string) for interoperability with DTD- and non-validating processors. XML Schema authors should not declare attributes other than xml:id as type xs:ID for interoperability with DTD- and non-validating processors. No interoperability guarantees are provided in these cases.

Consumers of documents validating the xml:id attributes against an appropriate schema can recognize IDs through the [type definition] family of PSVI properties.

Applications can recognize xml:id attributes as IDs by conceptually using a Minimally Conforming Schema Processor processing the schema above.

Note that the effects of a Minimally Conforming Schema Processor, processing the above schema, are approximated by simply looking for attributes named xml:id, ensuring the value of such attributes has the correct lexical form (NCName), and the value is unique within the document.

Issue (id-minimal-validation): Review with XML Schema WG our use of the Minimally Conforming Schema Processor.

4.3 Behaviour when no xml:id declaration is available

Issue (id-declaration): Strictly speaking the behaviour exposed here should not apply if xml:id is declared in a recognized part of the internal subset, in which case the default processing of [XML 1.0] is sufficient even if the processor is not validating.

A processor that does neither DTD nor XML Schema validation must report xml:id attributes found in documents using [XML Information Set] properties, assuming the following condition:

  • The attribute value must be a valid NCName.

  • No other xml:id attribute with the same attribute value has been found earlier in the document.

If those conditions are not satisfied then the processor should report the error to the application.

If those conditions are satisfied then the processor must report the xml:id attribute in at least one of the following ways:

Issue (id-strictness): Those rules are stricter than the ones a non-validating XML processor would apply, should those strict rules be relaxed?

4.3.1 Using the [attribute type] infoset property

The processor can report the IDness of the attribute in a DTD compatible manner by setting the [attribute type] infoset property of the attribute to ID.

4.3.2 Using the [type definition] family of properties respectively.

The processor can report the IDness of the attribute in an XML Schemas compatible manner by setting the PSVI [type definition] infoset property of the attribute to ID.

Issue (set-type-defintion): Is this option necessary since a minimally conformant processor can already do this (see 4.2 With XML Schema Validation).

5 Conformance

Conformance to xml:id for applications that rely on XML processors using DTD or XML Schemas validation consist in the use of the xml:id construct in the DTD or XML Schemas as explained in 4.1 With DTD Validation and 4.2 With XML Schema Validation, and by the conformance to the validation rules of DTDs and XML Schemas.

Conformance to xml:id for applications that rely on non-validating XML processor is defined by the recognition of xml:id attributes as defined in 4.3 Behaviour when no xml:id declaration is available.

5.1 XML Information Set Conformance

This specification conforms to the [XML Information Set]. The following information items must be present in the input infosets to enable correct processing:

  • Element Information Items with [attributes] property.

  • Attribute Information Items with [namespace name], [local name] and [normalized value] properties.

In addition, the following properties might be present in the output infoset:

  • [attribute type] properties on Attribute Information Items.

Appendices

A References

IETF RFC 2119
RFC 2119: Key words for use in RFCs to Indicate Requirement Levels. Internet Engineering Task Force, 1997. (See http://www.ietf.org/rfc/rfc2119.txt.)
Namespaces in XML
Tim Bray, Dave Hollander, and Andrew Layman, editors. Namespaces in XML. World Wide Web Consortium, 1999. (See http://www.w3.org/TR/REC-xml-names/.)
XML 1.0
Tim Bray, Jean Paoli, C.M. Sperberg-McQueen, and Eve Maler, editors. Extensible Markup Language (XML) 1.0 (Second Edition). World Wide Web Consortium, 1998. (See http://www.w3.org/TR/REC-xml.)
XML Information Set
John Cowan and Richard Tobin, editors. XML Information Set (Second Edition). World Wide Web Consortium, 2004. (See http://www.w3.org/TR/xml-infoset/.)

B References (Non-Normative)

XML Schemas
Henry S. Thompson, David Beech, Murray Maloney, Noah Mendelsohn, editors. XML Schema Part 1: Structures. World Wide Web Consortium, 2001. (See http://www.w3.org/TR/xmlschema-1/.)

C Impacts on other Standards (Non-Normative)

D Open Issues (Non-Normative)