by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)
<xsd:simpleType name="ID" id="ID"> <xsd:restriction base="xsd:NCName"/> </xsd:simpleType> |
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.
Applications that need to maintain a level of compatibility with DTDs shouldn't use this datatype for elements but should reserve it for attributes.
The lexical domain (xsd:NCName) of this datatype doesn't allow the definition of numerical identifiers or identifiers containing whitespace.
<element name="book"> <element name="isbn"> <data type="xsd:int"/> </element> <element name="title"> <data type="xsd:string"/> </element> <element name="author-ref"> <attribute name="ref"> <data type="xsd:IDREF"/> </attribute> </element> <element name="character-refs"> <data type="xsd:IDREFS"/> </element> <attribute name="identifier"> <data type="xsd:ID"/> </attribute> </element> |
This text is released under the Free Software Foundation GFDL.