<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="xmlspec-extended.xsl"?>
<!DOCTYPE spec PUBLIC "-//W3C//DTD Specification Version 2.8//EN"
                      "xmlspec.dtd" [
<!ENTITY year "2005">
<!ENTITY month "September">
<!ENTITY day "9">
<!ENTITY MM "09">
<!ENTITY DD "09">
<!ENTITY MMDD "&MM;&DD;">
<!ENTITY XMLCore-IPR "http://www.w3.org/2002/08/xmlcore-IPR-statements">
<!ENTITY internalXmlid "http://www.w3.org/XML/Group/&year;/xmlcore/xmlid/xml-id">
<!ENTITY externalXmlid "http://www.w3.org/TR/&year;/REC-xml-id-&year;&MMDD;/">
<!ENTITY xmlid "&externalXmlid;">
<!-- DTD Extensions -->
<!ENTITY % local.list.class "|options-list">
<!ELEMENT options-list (item+)>
<!ATTLIST options-list
diff (chg | add | del | off) #IMPLIED
role NMTOKEN #IMPLIED
id ID #IMPLIED
spacing (normal | compact) #IMPLIED
>
<!ATTLIST resolution
href CDATA #IMPLIED
>
]>
<spec w3c-doctype="rec">
<header>
<title>xml:id</title>
<version>Version 1.0</version>
<w3c-designation>xml-id-&year;&MMDD;</w3c-designation>
<w3c-doctype>W3C Recommendation</w3c-doctype>
<pubdate>
<day>&day;</day>
<month>&month;</month>
<year>&year;</year>
</pubdate>
<publoc>
<loc href="&xmlid;">&xmlid;</loc>
</publoc>
<altlocs>
<loc href="&xmlid;REC-xml-id-&year;&MMDD;.xml">XML</loc>
</altlocs>
<latestloc>
<loc href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</loc>
</latestloc>
<prevlocs>
<loc href="http://www.w3.org/TR/2005/PR-xml-id-20050712/">http://www.w3.org/TR/2005/PR-xml-id-20050712/</loc>
</prevlocs>
<authlist>
<author>
<name>Jonathan Marsh</name>
<affiliation>Microsoft</affiliation>
<email href="mailto:jmarsh@microsoft.com">jmarsh@microsoft.com</email>
</author>
<author>
<name>Daniel Veillard</name>
<affiliation>Invited Expert</affiliation>
<email href="mailto:daniel@veillard.com">daniel@veillard.com</email>
</author>
<author>
<name>Norman Walsh</name>
<affiliation>Sun Microsystems</affiliation>
<email href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</email>
</author>
</authlist>

<errataloc href="http://www.w3.org/2005/09/xml-id-errata"/>

<translationloc>
<loc href="http://www.w3.org/2003/03/Translations/byTechnology?technology=xml-id">http://www.w3.org/2003/03/Translations/byTechnology?technology=xml-id</loc>
</translationloc>

<status>
<p><emph>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
<loc href="http://www.w3.org/TR/">W3C technical reports index</loc> at
http://www.w3.org/TR/.</emph></p>

<p>This document is a Recommendation of the W3C. This document has
been developed by the
<loc href="http://www.w3.org/XML/Core/">W3C XML Core Working Group</loc>
as part of the
<loc href="http://www.w3.org/XML/Activity">XML
Activity</loc>.
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
<loc href="mailto:public-xml-id@w3.org">public-xml-id@w3.org</loc>,
a mailing list with a
<loc href="http://lists.w3.org/Archives/Public/public-xml-id/">public
archive</loc>. An errata
list for this edition
<loc href="http://www.w3.org/2005/09/xml-id-errata.html">is available</loc>.
</p>

<p>This document defines the meaning of the attribute
<att>xml:id</att> 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 <emph>xml:id Version 1.0 Proposed
Recommendation</emph> 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
<loc href="http://www.w3.org/XML/2005/01/xml-id-implementation.html">Implementation Report</loc>.
A test suite is
<loc href="http://www.w3.org/XML/Test/xml-id/">also available</loc>.</p>

<p>This document was produced under the <loc
href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
2004 W3C Patent Policy</loc>. 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 <loc
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</loc>.</p>

</status>
<abstract>
<p>This document defines the meaning of the attribute
<att>xml:id</att> 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>
</abstract>
<langusage>
<language id="EN">English</language>
</langusage>
<revisiondesc>
<slist>
<sitem>July 17, 2003: First Working Draft.</sitem>
<sitem>March 17, 2004: Second internal Working Draft.</sitem>
</slist>
</revisiondesc>
</header>
<body>
<div1 id="intro">
<head>Introduction</head>

<p><bibref ref="XML"/> and <bibref ref="XML11"/> 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>

<ulist>
<item><p>the ID value matches the allowed lexical
form,</p></item>
<item><p>the value is unique within the XML document, and that</p></item>
<item><p>each element has at most one single unique identifier</p>
</item>
</ulist>

<p>Declarations in either the
<loc href="http://www.w3.org/TR/REC-xml#dt-doctype">internal or external
DTD subset</loc> 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 <bibref ref="SOAP"/>,
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 <bibref ref="XMLSchemas"/> 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 <loc href="http://www.w3.org/TR/REC-xml/#dt-xml-proc">XML
processors</loc>, 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
<emph role="infoset-property">attribute type</emph> infoset property,
and the <emph role="infoset-property">type definition</emph> 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 <att>xml:id</att> 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 <att>xml:id</att> processing and to make
<termref def="dt-id-assignment">ID type assignment</termref> the default
behavior of their processors.
</p>

<p>It has been a guiding principle in the design of this specification
that the result of <att>xml:id</att> processing should be the same
as if an appropriate declaration has been seen and used by the processor.</p>

</div1>
<div1 id="terminology">
<head>Terminology</head>
<p>
<termdef id="dt-must" term="Must, May, etc.">The key words 
<term>must</term>, <term>must not</term>, <term>required</term>,
<term>shall</term>, <term>shall not</term>, <term>should</term>, 
<term>should not</term>, <term>recommended</term>, <term>may</term>, 
and <term>optional</term> in this specification are to be interpreted 
as described in <bibref ref="RFC2119"/>.</termdef>
</p>

<p><termdef id="dt-xml-id-proc" term="xml:id processor">An
<term>xml:id processor</term> is a software module that works in
conjunction with an <loc href="http://www.w3.org/TR/REC-xml/#dt-xml-proc">XML
processor</loc> to provide access to the IDs in an XML document.</termdef>
</p>

<p><termdef id="dt-xml-id-error" term="xml:id error">An
<term>xml:id error</term> is a non-fatal error that occurs when an
<termref def="dt-xml-id-proc">xml:id processor</termref> finds that
a document has violated the constraints of this specification.</termdef>
</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><termdef id="dt-id-assignment" term="ID type assignment">The
process of <term>ID type assignment</term> causes an <att>xml:id</att>
attribute value to be an ID.</termdef> This is often achieved by making the
type of the attribute "ID" in the infoset or
<loc href="http://www.w3.org/TR/xmlschema-1/#key-psvi">post-schema-validation
infoset</loc> (PSVI), but that is
not the only possible mechanism.</p>

<note>
<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>
</note>

</div1>

<div1 id="syntax">
<head>Syntax</head>
<p>Per <bibref ref="XMLNS"/> (and <bibref ref="XMLNS11"/>), 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 <bibref ref="XMLNS"/> (and <bibref
ref="XMLNS11"/>). Note that <att>xml:id</att> can be still used by
non-namespace-aware XML processors.</p>
</div1>

<div1 id="processing">
<head>Processing <att>xml:id</att> Attributes</head>

<p>Each <att>xml:id</att> attribute is processed in the following
way:</p>

<olist>
<item>
<p>The attribute's value is normalized according to the rules for
<loc href="http://www.w3.org/TR/REC-xml/#AVNormalize">attribute-value
normalization</loc> on attributes of type ID. For more details, see
<specref ref="id-avn"/>.</p>
<p>The infoset
<emph role="infoset-property">normalized value</emph> property is updated
with the normalized value.</p>
</item>
<item>
<p><termref def="dt-id-assignment">ID type assignment</termref> is
performed with the normalized value.</p>
</item>
</olist>

<p>An <att>xml:id</att> processor
<termref def="dt-must">must</termref> assure that the following
constraints hold for all <att>xml:id</att> attributes:</p>

<ulist>
<item>
<p>The normalized value of the attribute is an
<code>NCName</code> according to the
<titleref>Namespaces in XML</titleref>
Recommendation which has the same version as
the document in which this attribute occurs
(<loc href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</loc>
for XML 1.0, or
<loc href="http://www.w3.org/TR/xml-names11/#NT-NCName">NCName</loc>
for XML 1.1).</p>
</item>
<item>
<p>The declared type of the attribute, if it has one, is “ID”.
All declarations for <att>xml:id</att> attributes
<termref def="dt-must">must</termref>
specify “ID” as the type of the attribute.</p>
</item>
</ulist>

<p>An <att>xml:id</att> processor
<termref def="dt-must">should</termref> assure that the following
constraint holds:</p>

<ulist>
<item>
<p>The values of all attributes of type “ID” (which includes all
<att>xml:id</att> attributes) within a document are unique.</p>
</item>
</ulist>

<p>An <termref def="dt-xml-id-error">xml:id error</termref> occurs
for any <att>xml:id</att> attribute that does not satisfy the
constraints.</p>

<p>The <att>xml:id</att> processor performs 
<termref def="dt-id-assignment">ID type assignment</termref> on all
<att>xml:id</att> attributes, even those that do not satisfy
the constraints.</p>

<p>An <att>xml:id</att> processor
<termref def="dt-must">should</termref> update the infoset
<emph role="infoset-property">references</emph> property, as
described in Section 2.3 of <bibref ref="XMLIS"/>, 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
<emph>not</emph> imposed by <att>xml:id</att> 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>

</div1>

<div1 id="inform">
<head>Informing the Application</head>

<p>When ID type assignment
occurs, the <termref def="dt-xml-id-proc">xml:id processor</termref>
<termref def="dt-must">must</termref> report the assigned
<att>xml:id</att> attributes
to the application. How this is reported is implementation
dependent.</p>

<ulist>
<item id="Attribute_type">
<p>For applications that operate conceptually on the Infoset, an
<att>xml:id</att> processor can use the
<emph role="infoset-property">attribute type</emph> Infoset
property:</p>

<p>The <att>xml:id</att> processor <termref
def="dt-must">may</termref> report the results of ID type assignment in a
DTD compatible manner by setting the <emph
role="infoset-property">attribute type</emph> infoset property of the
attribute to ID.</p>
</item>

<item id="type_definition">
<p>For applications that operate conceptually on the PSVI, an
<att>xml:id</att> processor can use the
<emph role="infoset-property">type definition</emph> family
of PSVI properties:</p>

<p>The <att>xml:id</att> processor <termref def="dt-must">may</termref>
report the results of ID type assignment
in an XML Schema compatible manner by setting the PSVI
<emph role="infoset-property">type definition</emph> property of the
attribute to <code>xs:ID</code>.</p>
</item>

<item id="other_mechanisms">
<p>For applications that operate on data models defined in other ways,
the mechanisms are implementation dependent:</p>

<p>The <att>xml:id</att> processor <termref def="dt-must">may</termref>
report the results of ID type assignment in some other way.</p>
</item>
</ulist>

<p>The key requirement is that the application be made aware of the results
of ID type assignment.</p>

</div1>

<div1 id="errors">
<head>Errors</head>

<p>A violation of the constraints in this specification results in an
<termref def="dt-xml-id-error">xml:id error</termref>.
Such errors are not fatal, but <termref def="dt-must">should</termref>
be reported by the
<termref def="dt-xml-id-proc">xml:id processor</termref>.
In the interest of interoperability, it is strongly recommended that
<att>xml:id</att> errors not be silently ignored.</p>

</div1>

<div1 id="conformance">
<head>Conformance</head>

<div2 id="xmlid-conformance">
<head>Conformance to xml:id</head>

<p>Conformance to <att>xml:id</att> for applications that rely on
<loc href="http://www.w3.org/TR/2004/REC-xml-20040204/#dt-xml-proc">XML
processors</loc> using validation technologies consists in the
use of the <att>xml:id</att> construct as explained in
<specref ref="processing"/> and by conformance to both the constraints
of this specification and the rules of the validation technology.</p>

<p>Conformance to <att>xml:id</att> for applications that rely on
non-validating
<loc href="http://www.w3.org/TR/2004/REC-xml-20040204/#dt-xml-proc">XML
processors</loc> is defined by the recognition of <att>xml:id</att>
attributes as explained in 
<specref ref="processing"/> and by conformance to the constraints
of this specification.</p>

<p>Conformance to constraints that
“<termref def="dt-must">must</termref>” 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
<termref def="dt-xml-id-error">xml:id errors</termref>.
</p>

</div2>

<div2 id="infoset">
<head>XML Information Set Conformance</head>
<p>This specification conforms to the <bibref ref="XMLIS"/>.
The following information items <termref def="dt-must">must</termref> 
be present in the input infosets to enable correct processing:</p>
<ulist>
<item>
<p>
<emph role="info-item">Element Information Items</emph> with
<emph role="infoset-property">attributes</emph> property.</p>
</item>
<item>
<p>
<emph role="info-item">Attribute Information Items</emph> with
<emph role="infoset-property">namespace name</emph>,
<emph role="infoset-property">local name</emph> and
<emph role="infoset-property">normalized value</emph> properties.</p>
</item>
</ulist>
<p>In addition, the following properties might be present in the output infoset:</p>
<ulist>
<item>
<p>
<emph role="infoset-property">attribute type</emph> properties on <emph role="info-item">Attribute Information Items</emph>.</p>
</item>
</ulist>
</div2>
</div1>

<div1 id="extensibility">
<head>Extensibility</head>

<p>This specification is not extensible. There are no provisions for application
designers to alter the name of the <att>xml:id</att> attribute, the set of
attribute values that are considered IDs, the location(s) where they can
occur, or make any other extensions.</p>
</div1>

</body>
<back>
<div1 id="references">
<head>References</head>
<blist>
<bibl id="RFC2119" key="IETF RFC 2119" href="http://www.ietf.org/rfc/rfc2119.txt">
<titleref href="http://www.ietf.org/rfc/rfc2119.txt">RFC 2119: Key 
words for use in RFCs to Indicate Requirement Levels</titleref>.
Internet Engineering Task Force, 1997.
</bibl>
<bibl id="XML" key="XML 1.0" href="http://www.w3.org/TR/REC-xml/">
Tim Bray, Jean Paoli, C.M. Sperberg-McQueen, et. al., editors.
<titleref href="http://www.w3.org/TR/REC-xml/">Extensible Markup 
Language (XML) 1.0 (Third Edition).</titleref>
World Wide Web Consortium, 2004.
</bibl>
<bibl id="XML11" key="XML 1.1" href="http://www.w3.org/TR/xml11/">
Tim Bray, Jean Paoli, C.M. Sperberg-McQueen, et. al., editors.
<titleref href="http://www.w3.org/TR/xml11/">Extensible Markup 
Language (XML) 1.1.</titleref>
World Wide Web Consortium, 2004.
</bibl>
<bibl id="XMLIS" key="XML Information Set" href="http://www.w3.org/TR/xml-infoset/">
John Cowan and Richard Tobin, editors.
<titleref href="http://www.w3.org/TR/xml-infoset/">XML Information Set (Second Edition).</titleref>
World Wide Web Consortium, 2004.
</bibl>
<bibl id="XMLNS" key="Namespaces in XML" href="http://www.w3.org/TR/REC-xml-names/">
Tim Bray, Dave Hollander, and Andrew Layman, editors.
<titleref href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</titleref>.
World Wide Web Consortium, 1999.
</bibl>
<bibl id="XMLNS11" key="Namespaces in XML 1.1" href="http://www.w3.org/TR/xml-names11/">
Tim Bray, Dave Hollander, Andrew Layman, and Richard Tobin, editors.
<titleref href="http://www.w3.org/TR/xml-names11/">Namespaces in XML 1.1</titleref>.
World Wide Web Consortium, 2004.
</bibl>
</blist>
</div1>
<inform-div1>
<head>References</head>
<blist>
<bibl id="XMLSchemas" key="XML Schemas" href="http://www.w3.org/TR/xmlschema-1/">
Henry S. Thompson, David Beech, Murray Maloney, Noah Mendelsohn, editors.
<titleref href="http://www.w3.org/TR/xmlschema-1/">XML Schema Part 1: 
Structures.</titleref>
World Wide Web Consortium, 2001.
</bibl>
<bibl id="SOAP" key="SOAP" href="http://www.w3.org/TR/soap12-part1/">Martin
Gudgin, Marc Hadley, Noah Mendelsohn, et. al., editors.
<titleref href="http://www.w3.org/TR/soap12-part1/">SOAP Version 1.2 Part 1:
Messaging Framework</titleref>. World Wide Web Consortium, 2003.
</bibl>
</blist>
</inform-div1>

<inform-div1 id="impact">
<head>Impact on Canonicalization</head>

<p>The
<loc href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">Canonical XML
Version 1.0</loc> specification
<loc href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#DocSubsets">describes
a process</loc>
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
<termref def="dt-xml-id-error">xml:id errors</termref>,
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
<loc href="http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/">Exclusive
XML Canonicalization Version 1.0</loc> specification does not have
this feature and may be more appropriate for documents containing IDs.</p>
</inform-div1>

<inform-div1 id="validation-technologies">
<head>Validation Technologies</head>

<p>This appendix describes how <att>xml:id</att> processing interacts with
selected validation technologies.</p>

<div2 id="with-dtd-validation">
<head>With DTD Validation</head>

<p>DTD authors are encouraged to use <att>xml:id</att> attributes when
providing identifiers for elements declared in their DTDS.</p>

<p>The following DTD fragment illustrates a sample
declaration for the <att>xml:id</att> attribute:</p>

<eg>&lt;!ATTLIST someElement
    xml:id     ID          #IMPLIED
&gt;</eg>

<p>DTD authors are encouraged to declare attributes named
<att>xml:id</att> with the type <code>ID</code>.
A document that uses <att>xml:id</att> 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
<att>xml:id</att> attributes can recognize IDs through the <emph
role="infoset-property">attribute type</emph> property.</p>
</div2>

<div2 id="with-schema-validation">
<head>With XML Schema Validation</head>

<p>XML Schema authors are encouraged to use <att>xml:id</att>
attributes when providing identifiers for elements declared in their
schemas. Note that this can most easily be accomplished by importing
the schema for the <loc href="http://www.w3.org/XML/1998/namespace">XML
namespace</loc> and using the attribute declaration it contains.</p>

<p>The following XML Schema fragment for the XML namespace illustrates a
sample declaration for the <att>xml:id</att> attribute:</p>

<eg><![CDATA[<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.w3.org/XML/1998/namespace">

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

</xs:schema>]]></eg>

<p>XML Schema authors are encouraged to declare attributes named
<att>xml:id</att> with the type <code>xs:ID</code>.
A document that uses <att>xml:id</att> 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 <att>xml:id</att> attributes
against an appropriate schema for the XML namespace can recognize IDs
through the <emph role="infoset-property">type definition</emph>
family of PSVI properties.</p>

<p>Applications can recognize <att>xml:id</att> attributes as IDs by
conceptually using a <loc
href="http://www.w3.org/TR/xmlschema-1/#key-minimallyConforming">Minimally
Conforming Schema Processor</loc> 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 <att>xml:id</att>, ensuring the value of such
attributes has the correct lexical form (<loc
href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</loc>),
and the value is unique within the document.</p>

</div2>

<div2 id="with-relax-ng-validation">
<head>With RELAX NG Validation</head>

<p>RELAX NG Grammar authors are encouraged to use <att>xml:id</att>
attributes when providing identifiers for elements declared in their
schemas.</p>

<p>The following RELAX NG fragment illustrates a
sample declaration for the <att>xml:id</att> attribute:</p>

<eg><![CDATA[<optional xmlns="http://relaxng.org/ns/structure/1.0"
              datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <attribute name="xml:id">
    <data type="ID"/>
  </attribute>
</optional>]]></eg>

<p>RELAX NG Grammar authors are encouraged to declare attributes named
<att>xml:id</att> with the type <code>xs:ID</code>.
A document that uses <att>xml:id</att> attributes that have a declared
type other than <code>xs:ID</code> will always generate xml:id errors.</p>

</div2>
</inform-div1>

<inform-div1 id="id-avn">
<head>Attribute Value Normalization on IDs</head>

<p><bibref ref="XML"/> requires parsers to
<loc href="http://www.w3.org/TR/REC-xml/#AVNormalize">normalize</loc>
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 <att>xml:id</att>. 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>

<eg><![CDATA[<!DOCTYPE doc [
<!ATTLIST doc xml:id ID #IMPLIED>
]>
<doc xml:id="  one
">
<para xml:id="  two
"></para>
</doc>]]></eg>

<p>The initial value of <att>xml:id</att> on <el>doc</el> will be
“one” because the parser knew that it was an ID. The initial value
on <el>para</el> 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 <att>xml:id</att> attributes
on <el>doc</el> and <el>para</el> will be “one” and “two”, respectively.
These properly normalized values will be stored in the
<emph role="infoset-property">normalized value</emph> property in the
infoset. Performing xml:id processing changes the infoset if there
are incompletely normalized <att>xml:id</att> attributes.</p>

<note>
<p>For interoperability, document producers <termref
def="dt-must">should</termref> use fully normalized values that are
legal <code>NCNames</code> in
<att>xml:id</att> attributes.</p>
</note>

</inform-div1>

</back>
</spec>
