Unique keys

It may be a requirement that for each element of a particular type in one part of the document, there needs to be another element elsewhere in the document that is related to it. The XML standard provides a crude scheme for validating that such a relationship exists, using the ID and IDREF attribute types. Each attribute of type IDREF has a value that serves as a reference to the value of another element that has an attribute of type ID. Although used primarily to support hypertext linking features, this mechanism can be used purely to validate that each referencing object does in fact point to another real object in the same file. A parser reports an error if the value in an attribute with a type of IDREF cannot also be found in ...

Get XML Companion, The, Third Edition 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.