Name

xsd:ID — Definition of unique identifiers

Synopsis

<xsd:simpleType name="ID” id="ID">
 <xsd:restriction base="xsd:NCName"/>
</xsd:simpleType>

Derived from

xsd:NCName

Primary

xsd:string

Known subtypes

None

Data parameters (facets)

enumeration, length, maxLength, minLength, pattern

Description

The purpose of the xsd:ID datatype is to define unique identifiers that are global to a document and emulate the ID attribute type available in the XML DTDs.

Unlike their DTD counterparts, W3C XML Schema ID datatypes can be applied to not only attributes but also simple element content.

For both attributes and simple element content, the lexical domain of these datatypes is the lexical domain of XML nonqualified names (xsd:NCName).

Identifiers defined using this datatype are global to a document and provide a way to uniquely identify their containing element, whatever its type and name is.

The constraint added by this datatype, beyond the xsd:NCName datatype from which it is derived, is that the values of all the attributes and elements that have an ID datatype in a document must be unique.

Note that the behavior of this datatype depends on whether the RELAX NG implementation supports RELAX NG DTD compatibility datatype library, in which case, the uniqueness of the identifiers will be checked. This datatype can be used both for elements and for defining multiple type assignment to attributes defined as ID, depending on their location in the schema.

Restrictions

Applications that need to maintain a level ...

Get RELAX NG now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.