index.html 31.6 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN">
<head>
<meta name="generator" content="HTML Tidy for Linux/x86 (vers 12 April 2005), see www.w3.org" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xml:id Version 1.0</title>

<style type="text/css">
/*<![CDATA[*/
code           { font-family: monospace; }

div.constraint,
div.issue,
div.note,
div.notice     { margin-left: 2em; }

ol.enumar      { list-style-type: decimal; }
ol.enumla      { list-style-type: lower-alpha; }
ol.enumlr      { list-style-type: lower-roman; }
ol.enumua      { list-style-type: upper-alpha; }
ol.enumur      { list-style-type: upper-roman; }


div.exampleInner pre { margin-left: 1em;
                       margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
                  margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
                   border-top-width: 4px;
                   border-top-style: double;
                   border-top-color: #d3d3d3;
                   border-bottom-width: 4px;
                   border-bottom-style: double;
                   border-bottom-color: #d3d3d3;
                   padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
                    margin: 4px}
/*]]>*/
</style>
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-REC.css" />
</head>
<body>
<div class="head">
<p><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72" /></a></p>
<h1><a name="title" id="title"></a>xml:id Version 1.0</h1>
<h2><a name="w3c-doctype" id="w3c-doctype"></a>W3C Recommendation 9 September 2005</h2>
<dl>
<dt>This version:</dt>
<dd><a href="http://www.w3.org/TR/2005/REC-xml-id-20050909/">http://www.w3.org/TR/2005/REC-xml-id-20050909/</a></dd>
<dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a></dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2005/PR-xml-id-20050712/">http://www.w3.org/TR/2005/PR-xml-id-20050712/</a></dd>
<dt>Editors:</dt>
<dd>Jonathan Marsh, Microsoft <a href="mailto:jmarsh@microsoft.com">&lt;jmarsh@microsoft.com&gt;</a></dd>
<dd>Daniel Veillard, Invited Expert <a href="mailto:daniel@veillard.com">&lt;daniel@veillard.com&gt;</a></dd>
<dd>Norman Walsh, Sun Microsystems <a href="mailto:Norman.Walsh@Sun.COM">&lt;Norman.Walsh@Sun.COM&gt;</a></dd>
</dl>
<p>Please refer to the <a href="http://www.w3.org/2005/09/xml-id-errata"><strong>errata</strong></a> for this document, which may include normative corrections.</p>
<p>See also <a href="http://www.w3.org/2003/03/Translations/byTechnology?technology=xml-id"><strong>translations</strong></a>.</p>
<p>This document is also available in these non-normative formats: <a href="http://www.w3.org/TR/2005/REC-xml-id-20050909/REC-xml-id-20050909.xml">XML</a>.</p>
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>&#160;©&#160;2005&#160;<a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>),
All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p>
</div>
<hr />
<div>
<h2><a name="abstract" id="abstract"></a>Abstract</h2>
<p>This document defines the meaning of the attribute <code>xml:id</code> as an ID attribute in XML documents and defines processing of this attribute to identify IDs in the absence of validation, without fetching external resources, and without relying on an internal subset.</p>
</div>
<div>
<h2><a name="status" id="status"></a>Status of this Document</h2>
<p><em>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 <a href="http://www.w3.org/TR/">W3C technical reports index</a> at http://www.w3.org/TR/.</em></p>
<p>This document is a Recommendation of the W3C. This document has been developed by the <a href="http://www.w3.org/XML/Core/">W3C XML Core Working Group</a> as part of the <a href="http://www.w3.org/XML/Activity">XML Activity</a>. It has been reviewed by W3C Members and other interested parties and has been endorsed by the Director. It is a stable document and may be used as reference material or cited as a normative reference from another document. W3C's role in making the Recommendation is to draw
attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.</p>
<p>The English version of this specification is the only normative version. Translations of this document may be available.</p>
<p>If you have any comments on this document, send them to <a href="mailto:public-xml-id@w3.org">public-xml-id@w3.org</a>, a mailing list with a <a href="http://lists.w3.org/Archives/Public/public-xml-id/">public archive</a>. An errata list for this edition <a href="http://www.w3.org/2005/09/xml-id-errata.html">is available</a>.</p>
<p>This document defines the meaning of the attribute <code>xml:id</code> as an ID attribute in XML documents and defines processing of this attribute to identify IDs in the absence of validation, without fetching external resources, and without relying on an internal DTD subset.</p>
<p>This document is based upon the <em>xml:id Version 1.0 Proposed Recommendation</em> of 12 July 2005. Feedback received during that review resulted in minor editorial changes. Evidence of interoperation between at least two implementations of this specification are documented in the <a href="http://www.w3.org/XML/2005/01/xml-id-implementation.html">Implementation Report</a>. A test suite is <a href="http://www.w3.org/XML/Test/xml-id/">also available</a>.</p>
<p>This document was produced under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>. The Working Group maintains a <a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/18796/status">public list of patent disclosures</a> relevant to this document; that page also includes instructions for disclosing [and excluding] a patent. 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 <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p>
</div>
<div class="toc">
<h2><a name="contents" id="contents"></a>Table of Contents</h2>
<p class="toc">1 <a href="#intro">Introduction</a><br />
2 <a href="#terminology">Terminology</a><br />
3 <a href="#syntax">Syntax</a><br />
4 <a href="#processing">Processing xml:id Attributes</a><br />
5 <a href="#inform">Informing the Application</a><br />
6 <a href="#errors">Errors</a><br />
7 <a href="#conformance">Conformance</a><br />
&#160;&#160;&#160;&#160;7.1 <a href="#xmlid-conformance">Conformance to xml:id</a><br />
&#160;&#160;&#160;&#160;7.2 <a href="#infoset">XML Information Set Conformance</a><br />
8 <a href="#extensibility">Extensibility</a><br /></p>
<h3><a name="appendices" id="appendices"></a>Appendices</h3>
<p class="toc">A <a href="#references">References</a><br />
B <a href="#d0e642">References</a> (Non-Normative)<br />
C <a href="#impact">Impact on Canonicalization</a> (Non-Normative)<br />
D <a href="#validation-technologies">Validation Technologies</a> (Non-Normative)<br />
&#160;&#160;&#160;&#160;D.1 <a href="#with-dtd-validation">With DTD Validation</a><br />
&#160;&#160;&#160;&#160;D.2 <a href="#with-schema-validation">With XML Schema Validation</a><br />
&#160;&#160;&#160;&#160;D.3 <a href="#with-relax-ng-validation">With RELAX NG Validation</a><br />
E <a href="#id-avn">Attribute Value Normalization on IDs</a> (Non-Normative)<br /></p>
</div>
<hr />
<div class="body">
<div class="div1">
<h2><a name="intro" id="intro"></a>1 Introduction</h2>
<p><a href="#XML">[XML 1.0]</a> and <a href="#XML11">[XML 1.1]</a> provide 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</p>
<ul>
<li>
<p>the ID value matches the allowed lexical form,</p>
</li>
<li>
<p>the value is unique within the XML document, and that</p>
</li>
<li>
<p>each element has at most one single unique identifier</p>
</li>
</ul>
<p>Declarations in either the <a href="http://www.w3.org/TR/REC-xml#dt-doctype">internal or external DTD subset</a> of an XML document can declare attributes to be of type ID. However, processing the external DTD subset is optional for conformant XML processors; and some specifications, notably <a href="#SOAP">[SOAP]</a>, forbid DTDs completely, leaving no guarantee that all consumers of the XML document will be able to successfully recognize the identifiers.</p>
<p>Identifiers can be declared through external mechanisms as well. Of particular interest is <a href="#XMLSchemas">[XML Schemas]</a> which provides a type "xs:ID" with the same uniqueness and validity constraints as XML. However, there are no guarantees that consumers will have the "correct" schema available, nor that they will process it if they do.</p>
<p>A mechanism allowing unique element identifiers to be recognized by all conformant <a href="http://www.w3.org/TR/REC-xml/#dt-xml-proc">XML processors</a>, whether they validate or not, is desirable in making XML sub-resource linking robust. This specification allows authors to identify elements with IDs that can be recognized by any processor without regard to how, or if, any internal or external declarations are available.</p>
<p>An additional problem is that DTD-based and XML Schema-based identifiers are exposed through different conceptual mechanisms - the <em>attribute type</em> infoset property, and the <em>type definition</em> family of properties respectively. A uniform mechanism for recognizing identifiers is desirable.</p>
<p>This specification provides such a mechanism: it describes the semantics of <code>xml:id</code> attributes. This specification has been designed to be a separate layer in processing and to be compatible with existing validation technologies. Implementors are encouraged to support <code>xml:id</code> processing and to make <a title="ID type assignment" href="#dt-id-assignment">ID type assignment</a> the default behavior of their processors.</p>
<p>It has been a guiding principle in the design of this specification that the result of <code>xml:id</code> processing should be the same as if an appropriate declaration has been seen and used by the processor.</p>
</div>
<div class="div1">
<h2><a name="terminology" id="terminology"></a>2 Terminology</h2>
<p>[<a name="dt-must" id="dt-must" title="Must, May, etc.">Definition</a>: The key words <b>must</b>, <b>must not</b>, <b>required</b>, <b>shall</b>, <b>shall not</b>, <b>should</b>, <b>should not</b>, <b>recommended</b>, <b>may</b>, and <b>optional</b> in this specification are to be interpreted as described in <a href="#RFC2119">[IETF RFC 2119]</a>.]</p>
<p>[<a name="dt-xml-id-proc" id="dt-xml-id-proc" title="xml:id processor">Definition</a>: An <b>xml:id processor</b> is a software module that works in conjunction with an <a href="http://www.w3.org/TR/REC-xml/#dt-xml-proc">XML processor</a> to provide access to the IDs in an XML document.]</p>
<p>[<a name="dt-xml-id-error" id="dt-xml-id-error" title="xml:id error">Definition</a>: An <b>xml:id error</b> is a non-fatal error that occurs when an <a title="xml:id processor" href="#dt-xml-id-proc">xml:id processor</a> finds that a document has violated the constraints of this specification.]</p>
<p>Validation is the process of comparing an XML document (or part of an XML document) against a grammar or set of rules to determine if the actual structure of the document satisfies the constraints of the grammar or the rules. Some validation technologies also perform type assignment, determining not only if the document satisfies the specified constraints but also determining, for example, which (elements and/or) attributes are of type “ID”.</p>
<p>Although often performed together, validation and type assignment are not the same process. A non-validating XML 1.0 processor, for example, can perform type assignment using only declarations from the internal subset, without ever having any information about the structural validity of the document.</p>
<p>[<a name="dt-id-assignment" id="dt-id-assignment" title="ID type assignment">Definition</a>: The process of <b>ID type assignment</b> causes an <code>xml:id</code> attribute value to be an ID.] This is often achieved by making the type of the attribute "ID" in the infoset or <a href="http://www.w3.org/TR/xmlschema-1/#key-psvi">post-schema-validation infoset</a> (PSVI), but that is not the only possible mechanism.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Application-level processing of IDs, including which elements can actually be addressed by which ID values, is beyond the scope of this specification.</p>
</div>
</div>
<div class="div1">
<h2><a name="syntax" id="syntax"></a>3 Syntax</h2>
<p>Per <a href="#XMLNS">[Namespaces in XML]</a> (and <a href="#XMLNS11">[Namespaces in XML 1.1]</a>), prefixes beginning “xml” are reserved for use by XML and XML-related specifications. This specification licenses the use of the attribute “xml:id” for use as a common syntax for identifiers in XML with the semantics specified herein.</p>
<p>Authors of XML documents are encouraged to name their ID attributes "xml:id" to increase the interoperability of these identifiers on the Web.</p>
<p>In namespace-aware XML processors, the "xml" prefix is bound to the namespace name <code>http://www.w3.org/XML/1998/namespace</code> as described in Namespaces in XML <a href="#XMLNS">[Namespaces in XML]</a> (and <a href="#XMLNS11">[Namespaces in XML 1.1]</a>). Note that <code>xml:id</code> can be still used by non-namespace-aware XML processors.</p>
</div>
<div class="div1">
<h2><a name="processing" id="processing"></a>4 Processing <code>xml:id</code> Attributes</h2>
<p>Each <code>xml:id</code> attribute is processed in the following way:</p>
<ol class="enumar">
<li>
<p>The attribute's value is normalized according to the rules for <a href="http://www.w3.org/TR/REC-xml/#AVNormalize">attribute-value normalization</a> on attributes of type ID. For more details, see <a href="#id-avn"><b>E Attribute Value Normalization on IDs</b></a>.</p>
<p>The infoset <em>normalized value</em> property is updated with the normalized value.</p>
</li>
<li>
<p><a title="ID type assignment" href="#dt-id-assignment">ID type assignment</a> is performed with the normalized value.</p>
</li>
</ol>
<p>An <code>xml:id</code> processor <a title="Must, May, etc." href="#dt-must">must</a> assure that the following constraints hold for all <code>xml:id</code> attributes:</p>
<ul>
<li>
<p>The normalized value of the attribute is an <code>NCName</code> according to the <cite>Namespaces in XML</cite> Recommendation which has the same version as the document in which this attribute occurs (<a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a> for XML 1.0, or <a href="http://www.w3.org/TR/xml-names11/#NT-NCName">NCName</a> for XML 1.1).</p>
</li>
<li>
<p>The declared type of the attribute, if it has one, is “ID”. All declarations for <code>xml:id</code> attributes <a title="Must, May, etc." href="#dt-must">must</a> specify “ID” as the type of the attribute.</p>
</li>
</ul>
<p>An <code>xml:id</code> processor <a title="Must, May, etc." href="#dt-must">should</a> assure that the following constraint holds:</p>
<ul>
<li>
<p>The values of all attributes of type “ID” (which includes all <code>xml:id</code> attributes) within a document are unique.</p>
</li>
</ul>
<p>An <a title="xml:id error" href="#dt-xml-id-error">xml:id error</a> occurs for any <code>xml:id</code> attribute that does not satisfy the constraints.</p>
<p>The <code>xml:id</code> processor performs <a title="ID type assignment" href="#dt-id-assignment">ID type assignment</a> on all <code>xml:id</code> attributes, even those that do not satisfy the constraints.</p>
<p>An <code>xml:id</code> processor <a title="Must, May, etc." href="#dt-must">should</a> update the infoset <em>references</em> property, as described in Section 2.3 of <a href="#XMLIS">[XML Information Set]</a>, and update any implementation-specific structures used for cross-referencing to reflect the results of ID type assignment.</p>
<p>Many validation technologies impose the constraint that an XML element can have at most one attribute of type ID. That constraint is <em>not</em> imposed by <code>xml:id</code> processing.</p>
<p>This specification defines xml:id processing, but it is up to the application to determine when such processing occurs. Users of applications that provide facilities for modifying XML documents may reasonably expect xml:id processing to occur whenever a change is made to an ID value.</p>
</div>
<div class="div1">
<h2><a name="inform" id="inform"></a>5 Informing the Application</h2>
<p>When ID type assignment occurs, the <a title="xml:id processor" href="#dt-xml-id-proc">xml:id processor</a> <a title="Must, May, etc." href="#dt-must">must</a> report the assigned <code>xml:id</code> attributes to the application. How this is reported is implementation dependent.</p>
<ul>
<li>
<p>For applications that operate conceptually on the Infoset, an <code>xml:id</code> processor can use the <em>attribute type</em> Infoset property:</p>
<p>The <code>xml:id</code> processor <a title="Must, May, etc." href="#dt-must">may</a> report the results of ID type assignment in a DTD compatible manner by setting the <em>attribute type</em> infoset property of the attribute to ID.</p>
</li>
<li>
<p>For applications that operate conceptually on the PSVI, an <code>xml:id</code> processor can use the <em>type definition</em> family of PSVI properties:</p>
<p>The <code>xml:id</code> processor <a title="Must, May, etc." href="#dt-must">may</a> report the results of ID type assignment in an XML Schema compatible manner by setting the PSVI <em>type definition</em> property of the attribute to <code>xs:ID</code>.</p>
</li>
<li>
<p>For applications that operate on data models defined in other ways, the mechanisms are implementation dependent:</p>
<p>The <code>xml:id</code> processor <a title="Must, May, etc." href="#dt-must">may</a> report the results of ID type assignment in some other way.</p>
</li>
</ul>
<p>The key requirement is that the application be made aware of the results of ID type assignment.</p>
</div>
<div class="div1">
<h2><a name="errors" id="errors"></a>6 Errors</h2>
<p>A violation of the constraints in this specification results in an <a title="xml:id error" href="#dt-xml-id-error">xml:id error</a>. Such errors are not fatal, but <a title="Must, May, etc." href="#dt-must">should</a> be reported by the <a title="xml:id processor" href="#dt-xml-id-proc">xml:id processor</a>. In the interest of interoperability, it is strongly recommended that <code>xml:id</code> errors not be silently ignored.</p>
</div>
<div class="div1">
<h2><a name="conformance" id="conformance"></a>7 Conformance</h2>
<div class="div2">
<h3><a name="xmlid-conformance" id="xmlid-conformance"></a>7.1 Conformance to xml:id</h3>
<p>Conformance to <code>xml:id</code> for applications that rely on <a href="http://www.w3.org/TR/2004/REC-xml-20040204/#dt-xml-proc">XML processors</a> using validation technologies consists in the use of the <code>xml:id</code> construct as explained in <a href="#processing"><b>4 Processing xml:id Attributes</b></a> and by conformance to both the constraints of this specification and the rules of the validation technology.</p>
<p>Conformance to <code>xml:id</code> for applications that rely on non-validating <a href="http://www.w3.org/TR/2004/REC-xml-20040204/#dt-xml-proc">XML processors</a> is defined by the recognition of <code>xml:id</code> attributes as explained in <a href="#processing"><b>4 Processing xml:id Attributes</b></a> and by conformance to the constraints of this specification.</p>
<p>Conformance to constraints that “<a title="Must, May, etc." href="#dt-must">must</a>” be assured is mandatory. It is recommended that applications assure the other constraints as well. This specification defines no simply optional constraints.</p>
<p>A document is conformant to this specification if it generates no <a title="xml:id error" href="#dt-xml-id-error">xml:id errors</a>.</p>
</div>
<div class="div2">
<h3><a name="infoset" id="infoset"></a>7.2 XML Information Set Conformance</h3>
<p>This specification conforms to the <a href="#XMLIS">[XML Information Set]</a>. The following information items <a title="Must, May, etc." href="#dt-must">must</a> be present in the input infosets to enable correct processing:</p>
<ul>
<li>
<p><em>Element Information Items</em> with <em>attributes</em> property.</p>
</li>
<li>
<p><em>Attribute Information Items</em> with <em>namespace name</em>, <em>local name</em> and <em>normalized value</em> properties.</p>
</li>
</ul>
<p>In addition, the following properties might be present in the output infoset:</p>
<ul>
<li>
<p><em>attribute type</em> properties on <em>Attribute Information Items</em>.</p>
</li>
</ul>
</div>
</div>
<div class="div1">
<h2><a name="extensibility" id="extensibility"></a>8 Extensibility</h2>
<p>This specification is not extensible. There are no provisions for application designers to alter the name of the <code>xml:id</code> attribute, the set of attribute values that are considered IDs, the location(s) where they can occur, or make any other extensions.</p>
</div>
</div>
<div class="back">
<div class="div1">
<h2><a name="references" id="references"></a>A References</h2>
<dl>
<dt class="label"><a name="RFC2119" id="RFC2119"></a>IETF RFC 2119</dt>
<dd><a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>RFC 2119: Key words for use in RFCs to Indicate Requirement Levels</cite></a>. Internet Engineering Task Force, 1997. (See http://www.ietf.org/rfc/rfc2119.txt.)</dd>
<dt class="label"><a name="XML" id="XML"></a>XML 1.0</dt>
<dd>Tim Bray, Jean Paoli, C.M. Sperberg-McQueen, et. al., editors. <a href="http://www.w3.org/TR/REC-xml/"><cite>Extensible Markup Language (XML) 1.0 (Third Edition).</cite></a> World Wide Web Consortium, 2004. (See http://www.w3.org/TR/REC-xml/.)</dd>
<dt class="label"><a name="XML11" id="XML11"></a>XML 1.1</dt>
<dd>Tim Bray, Jean Paoli, C.M. Sperberg-McQueen, et. al., editors. <a href="http://www.w3.org/TR/xml11/"><cite>Extensible Markup Language (XML) 1.1.</cite></a> World Wide Web Consortium, 2004. (See http://www.w3.org/TR/xml11/.)</dd>
<dt class="label"><a name="XMLIS" id="XMLIS"></a>XML Information Set</dt>
<dd>John Cowan and Richard Tobin, editors. <a href="http://www.w3.org/TR/xml-infoset/"><cite>XML Information Set (Second Edition).</cite></a> World Wide Web Consortium, 2004. (See http://www.w3.org/TR/xml-infoset/.)</dd>
<dt class="label"><a name="XMLNS" id="XMLNS"></a>Namespaces in XML</dt>
<dd>Tim Bray, Dave Hollander, and Andrew Layman, editors. <a href="http://www.w3.org/TR/REC-xml-names/"><cite>Namespaces in XML</cite></a>. World Wide Web Consortium, 1999. (See http://www.w3.org/TR/REC-xml-names/.)</dd>
<dt class="label"><a name="XMLNS11" id="XMLNS11"></a>Namespaces in XML 1.1</dt>
<dd>Tim Bray, Dave Hollander, Andrew Layman, and Richard Tobin, editors. <a href="http://www.w3.org/TR/xml-names11/"><cite>Namespaces in XML 1.1</cite></a>. World Wide Web Consortium, 2004. (See http://www.w3.org/TR/xml-names11/.)</dd>
</dl>
</div>
<div class="div1">
<h2><a name="d0e642" id="d0e642"></a>B References (Non-Normative)</h2>
<dl>
<dt class="label"><a name="XMLSchemas" id="XMLSchemas"></a>XML Schemas</dt>
<dd>Henry S. Thompson, David Beech, Murray Maloney, Noah Mendelsohn, editors. <a href="http://www.w3.org/TR/xmlschema-1/"><cite>XML Schema Part 1: Structures.</cite></a> World Wide Web Consortium, 2001. (See http://www.w3.org/TR/xmlschema-1/.)</dd>
<dt class="label"><a name="SOAP" id="SOAP"></a>SOAP</dt>
<dd>Martin Gudgin, Marc Hadley, Noah Mendelsohn, et. al., editors. <a href="http://www.w3.org/TR/soap12-part1/"><cite>SOAP Version 1.2 Part 1: Messaging Framework</cite></a>. World Wide Web Consortium, 2003. (See http://www.w3.org/TR/soap12-part1/.)</dd>
</dl>
</div>
<div class="div1">
<h2><a name="impact" id="impact"></a>C Impact on Canonicalization (Non-Normative)</h2>
<p>The <a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">Canonical XML Version 1.0</a> specification <a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#DocSubsets">describes a process</a> whereby attributes in the <code>xml:</code> namespace are inherited in a canonicalized document. While this produces a reasonable result with <code>xml:lang</code> or <code>xml:space</code> attributes, processing <code>xml:id</code> attributes in this way is likely to produce documents that contain <a title=
"xml:id error" href="#dt-xml-id-error">xml:id errors</a>, specifically <code>xml:id</code> attribute values that are not unique.</p>
<p>This is an apparent flaw in the design of Canonical XML. The <a href="http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/">Exclusive XML Canonicalization Version 1.0</a> specification does not have this feature and may be more appropriate for documents containing IDs.</p>
</div>
<div class="div1">
<h2><a name="validation-technologies" id="validation-technologies"></a>D Validation Technologies (Non-Normative)</h2>
<p>This appendix describes how <code>xml:id</code> processing interacts with selected validation technologies.</p>
<div class="div2">
<h3><a name="with-dtd-validation" id="with-dtd-validation"></a>D.1 With DTD Validation</h3>
<p>DTD authors are encouraged to use <code>xml:id</code> attributes when providing identifiers for elements declared in their DTDS.</p>
<p>The following DTD fragment illustrates a sample declaration for the <code>xml:id</code> attribute:</p>
<div class="exampleInner">
<pre>
&lt;!ATTLIST someElement
    xml:id     ID          #IMPLIED
&gt;
</pre></div>
<p>DTD authors are encouraged to declare attributes named <code>xml:id</code> with the type <code>ID</code>. A document that uses <code>xml:id</code> attributes that have a declared type other than <code>ID</code> will always generate xml:id errors.</p>
<p>Consumers of documents validated using properly declared <code>xml:id</code> attributes can recognize IDs through the <em>attribute type</em> property.</p>
</div>
<div class="div2">
<h3><a name="with-schema-validation" id="with-schema-validation"></a>D.2 With XML Schema Validation</h3>
<p>XML Schema authors are encouraged to use <code>xml:id</code> attributes when providing identifiers for elements declared in their schemas. Note that this can most easily be accomplished by importing the schema for the <a href="http://www.w3.org/XML/1998/namespace">XML namespace</a> and using the attribute declaration it contains.</p>
<p>The following XML Schema fragment for the XML namespace illustrates a sample declaration for the <code>xml:id</code> attribute:</p>
<div class="exampleInner">
<pre>
&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.w3.org/XML/1998/namespace"&gt;

    &lt;xs:attribute name="id" type="xs:ID"/&gt;

&lt;/xs:schema&gt;
</pre></div>
<p>XML Schema authors are encouraged to declare attributes named <code>xml:id</code> with the type <code>xs:ID</code>. A document that uses <code>xml:id</code> attributes that have a declared type other than <code>xs:ID</code> will always generate xml:id errors.</p>
<p>Consumers of documents validating the <code>xml:id</code> attributes against an appropriate schema for the XML namespace can recognize IDs through the <em>type definition</em> family of PSVI properties.</p>
<p>Applications can recognize <code>xml:id</code> attributes as IDs by conceptually using a <a href="http://www.w3.org/TR/xmlschema-1/#key-minimallyConforming">Minimally Conforming Schema Processor</a> and the schema above.</p>
<p>Note that the effects of a Minimally Conforming Schema Processor, processing the above schema, are approximated by simply looking for attributes named <code>xml:id</code>, ensuring the value of such attributes has the correct lexical form (<a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>), and the value is unique within the document.</p>
</div>
<div class="div2">
<h3><a name="with-relax-ng-validation" id="with-relax-ng-validation"></a>D.3 With RELAX NG Validation</h3>
<p>RELAX NG Grammar authors are encouraged to use <code>xml:id</code> attributes when providing identifiers for elements declared in their schemas.</p>
<p>The following RELAX NG fragment illustrates a sample declaration for the <code>xml:id</code> attribute:</p>
<div class="exampleInner">
<pre>
&lt;optional xmlns="http://relaxng.org/ns/structure/1.0"
              datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"&gt;
  &lt;attribute name="xml:id"&gt;
    &lt;data type="ID"/&gt;
  &lt;/attribute&gt;
&lt;/optional&gt;
</pre></div>
<p>RELAX NG Grammar authors are encouraged to declare attributes named <code>xml:id</code> with the type <code>xs:ID</code>. A document that uses <code>xml:id</code> attributes that have a declared type other than <code>xs:ID</code> will always generate xml:id errors.</p>
</div>
</div>
<div class="div1">
<h2><a name="id-avn" id="id-avn"></a>E Attribute Value Normalization on IDs (Non-Normative)</h2>
<p><a href="#XML">[XML 1.0]</a> requires parsers to <a href="http://www.w3.org/TR/REC-xml/#AVNormalize">normalize</a> all attribute values. Normalization expands character references, expands entity references, and cleans up line end characters. Attributes of type ID are subject to additional normalization rules: removing leading and trailing space characters and replacing sequences of spaces with a single space.</p>
<p>The xml:id processor has to assure that both steps of normalization are performed all attributes named <code>xml:id</code>. In particular, the parser may not have performed the additional normalization steps required for attributes of type ID because the attribute may not be declared or may be declared as an ID.</p>
<p>Consider the following document:</p>
<div class="exampleInner">
<pre>
&lt;!DOCTYPE doc [
&lt;!ATTLIST doc xml:id ID #IMPLIED&gt;
]&gt;
&lt;doc xml:id="  one
"&gt;
&lt;para xml:id="  two
"&gt;&lt;/para&gt;
&lt;/doc&gt;
</pre></div>
<p>The initial value of <code>xml:id</code> on <code>doc</code> will be “one” because the parser knew that it was an ID. The initial value on <code>para</code> will be “ two ”. Because the parser didn't know it was an ID, it will not have performed the additional normalizations required.</p>
<p>After xml:id processing, the value of the <code>xml:id</code> attributes on <code>doc</code> and <code>para</code> will be “one” and “two”, respectively. These properly normalized values will be stored in the <em>normalized value</em> property in the infoset. Performing xml:id processing changes the infoset if there are incompletely normalized <code>xml:id</code> attributes.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>For interoperability, document producers <a title="Must, May, etc." href="#dt-must">should</a> use fully normalized values that are legal <code>NCNames</code> in <code>xml:id</code> attributes.</p>
</div>
</div>
</div>
</body>
</html>