index.html 46.3 KB

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en"><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>XPointer Framework</title><style type="text/css">
code           { font-family: monospace; }

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

li p           { margin-top: 0.3em;
                 margin-bottom: 0.3em; }

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>XPointer Framework</h1>
<h2><a name="w3c-doctype" id="w3c-doctype"></a>W3C Recommendation 25 March 2003</h2><dl><dt>This version:</dt><dd>
			<a href="http://www.w3.org/TR/2003/REC-xptr-framework-20030325/">http://www.w3.org/TR/2003/REC-xptr-framework-20030325/</a>
		</dd><dt>Latest version:</dt><dd>
			<a href="http://www.w3.org/TR/xptr-framework/">http://www.w3.org/TR/xptr-framework/</a>
		</dd><dt>Previous version:</dt><dd>
			<a href="http://www.w3.org/TR/2002/PR-xptr-framework-20021113/">http://www.w3.org/TR/2002/PR-xptr-framework-20021113/</a>
			
		</dd><dt>Editors:</dt><dd>Paul Grosso, Arbortext, Inc. <a href="mailto:paul@arbortext.com">&lt;paul@arbortext.com&gt;</a></dd><dd>Eve Maler, Sun Microsystems <a href="mailto:eve.maler@sun.com">&lt;eve.maler@sun.com&gt;</a></dd><dd>Jonathan Marsh, Microsoft <a href="mailto:jmarsh@microsoft.com">&lt;jmarsh@microsoft.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/2003/03/REC-xptr-20030325-errata"><strong>errata</strong></a> for this document, which may
       include some normative corrections.</p><p>This document is also available in these non-normative formats: <a href="http://www.w3.org/TR/2003/REC-xptr-framework-20030325/xptr-framework.xml">XML</a>.</p><p>The English version of this specification is the only normative version.
Non-normative <a href="http://www.w3.org/2003/03/xptr-translations"><strong>translations</strong></a> may also be available.</p><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>&nbsp;&copy;&nbsp;2003&nbsp;<a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>&reg;</sup> (<a href="http://www.lcs.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>, <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-software">software licensing</a> rules apply.</p></div><hr><div>
<h2><a name="abstract" id="abstract"></a>Abstract</h2><p>This specification defines the XML Pointer Language (XPointer) Framework, an extensible system for XML addressing that underlies additional XPointer scheme specifications. The framework is intended to be used as a basis for fragment identifiers for any resource whose Internet media type is one of <code>text/xml</code>, <code>application/xml</code>, <code>text/xml-external-parsed-entity</code>, or <code>application/xml-external-parsed-entity</code>. Other XML-based media types are also encouraged to use this framework in defining their own fragment identifier languages.</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. The latest status of this document series is maintained at the W3C.</em></p><p>This document is a <a href="http://www.w3.org/Consortium/Process-20010719/#RecsW3C">Recommendation (REC)</a> of the W3C.	It has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a W3C Recommendation. 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>This document has been produced by the <a href="http://www.w3.org/XML/Linking">W3C XML Linking Working Group</a> as part of the <a href="http://www.w3.org/XML/Activity">XML Activity</a>.  It is intended to address a core subset of the original <a href="http://www.w3.org/TR/NOTE-xptr-req">XPointer requirements</a>, and to serve, along with the accompanying <a href="http://www.w3.org/TR/xptr-element/">XPointer element() Scheme</a> and <a href="http://www.w3.org/TR/xptr-xmlns/">XPointer xmlns() Scheme</a> specifications, as all or a foundational part of a fragment identifier syntax for the XML Media types.</p>
<p id="notice-20111024" style="border: solid black 1px; padding:0.5em; background: #FFB;"><strong>Document Status Update 2011-10-24</strong>: This paragraph is informative. On 18 November 2005 an <a href="http://www.w3.org/2005/04/xpointer-schemes/">XPointer Schemes Registry</a> was approved for public use under the terms of an <a href="http://www.w3.org/2005/04/xpointer-policy.html">XPointer Scheme Name Registry Policy</a>.</p>
<p>Public comments on this Recommendation are welcome.  Please send them to
the public mailing list <a href="mailto:www-xml-linking-comments@w3.org">www-xml-linking-comments@w3.org</a> (<a href="http://lists.w3.org/Archives/Public/www-xml-linking-comments/">archive</a>).</p><p>Information about implementations relevant to this
specification and the accompanying <a href="http://www.w3.org/TR/xptr-element/">XPointer element() Scheme</a> and <a href="http://www.w3.org/TR/xptr-xmlns/">XPointer xmlns() Scheme</a> can be found in the <a href="http://www.w3.org/XML/2002/10/LinkingImplementations.html">Implementation Report</a>.</p><p>There are patent disclosures and license commitments associated with
this Recommendation, which may be found on the <a href="http://www.w3.org/2002/06/xptr_IPR_summary.html">XPointer IPR Statement</a> page in conformance with <a href="http://www.w3.org/Consortium/Process-20010719/#ipr">W3C policy</a>.</p><p>A list of current W3C Recommendations and other technical documents can
be found at <a href="http://www.w3.org/TR/">http://www.w3.org/TR/</a>.  W3C publications may be updated, replaced, or obsoleted by other documents at any time.</p></div><div class="toc">
<h2><a name="contents" id="contents"></a>Table of Contents</h2><p class="toc">1 <a href="#introduction">Introduction</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;1.1 <a href="#notation">Notation</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;1.2 <a href="#terminology">Terminology</a><br>
2 <a href="#conformance">Conformance</a><br>
3 <a href="#language">Language and Processing</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;3.1 <a href="#syntax">Syntax</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;3.2 <a href="#shorthand">Shorthand Pointer</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;3.3 <a href="#scheme">Scheme-Based Pointer</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;3.4 <a href="#nsContext">Namespace Binding Context</a><br>
4 <a href="#escaping">Character Escaping</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;4.1 <a href="#escapingModel">Escaping Contexts</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;4.2 <a href="#escExamples">Examples of Escaping</a><br>
</p>
<h3><a name="appendices" id="appendices"></a>Appendix</h3><p class="toc">A <a href="#references">References</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;A.1 <a href="#normRefs">Normative References</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;A.2 <a href="#nonnormRef">Non-Normative References</a><br>
</p></div><hr><div class="body"><div class="div1">
<h2><a name="introduction" id="introduction"></a>1 Introduction</h2><p>This specification defines the XML Pointer Language (XPointer) Framework, an extensible system for XML addressing that underlies additional XPointer scheme specifications. The framework is intended to be used as a basis for fragment identifiers for any resource whose Internet media type is one of <code>text/xml</code>, <code>application/xml</code>, <code>text/xml-external-parsed-entity</code>, or <code>application/xml-external-parsed-entity</code>. Other XML-based media types are also encouraged to use this framework in defining their own fragment identifier languages.</p><p>Many types of XML-processing applications need to address into the internal structures of XML resources using URI references, for example, the XML Linking Language <a href="#XLink">[XLink]</a>, XML Inclusions <a href="#xinclude">[XInclude]</a>, the Resource Description Framework <a href="#rdf">[RDF]</a>, and SOAP 1.2 <a href="#soap12">[SOAP12]</a>. This specification does not constrain the types of applications that utilize URI references to XML resources, nor does it constrain or dictate the behavior of those applications once they locate the desired information in those resources.</p><div class="div2">
<h3><a name="notation" id="notation"></a>1.1 Notation</h3><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">[RFC 2119]</a>.]
				</p><p>The formal grammar for the XPointer Framework is given using simple Extended Backus-Naur Form (EBNF) notation, as described in the XML Recommendation <a href="#XML">[XML]</a>.</p></div><div class="div2">
<h3><a name="terminology" id="terminology"></a>1.2 Terminology</h3><dl><dt class="label">
							[<a name="dt-pointer" id="dt-pointer" title="pointer">Definition</a>: 
								<b>pointer</b>
							]
						</dt><dd><p>A string conforming to this specification. This specification defines the syntax and semantics of pointers.</p></dd><dt class="label">
							[<a name="dt-pointerpart" id="dt-pointerpart" title="pointer part">Definition</a>: 
								<b>pointer part</b>
							]
						</dt><dd><p>A portion of a pointer that provides a scheme name and some pointer data that conforms to the definition of that scheme.  The XPointer processor evaluates a pointer part to identify zero or more subresources within an XML resource.
							</p></dd><dt class="label">
							[<a name="dt-scheme" id="dt-scheme" title="scheme">Definition</a>: 
								<b>scheme</b>
							]
						</dt><dd><p>A specialized pointer data format that has a name and is defined in a specification.</p></dd><dt class="label">
							[<a name="dt-processor" id="dt-processor" title="XPointer processor">Definition</a>: 
								<b>XPointer processor</b>
							]
						</dt><dd><p>A software component that identifies subresources of an XML resource by applying a pointer to it. This specification defines the behavior
of XPointer processors.</p></dd><dt class="label">
							[<a name="dt-app" id="dt-app" title="application">Definition</a>: 
								<b>application</b>
							]
						</dt><dd><p>A software component that incorporates or uses an XPointer processor because it needs to access XML subresources. The occurrence and usage of XPointers, and the behavior to be applied to resources and subresources obtained by processing those XPointers, are governed by the definition of each application's corresponding data format (which could be XML-based or non-XML-based). For example, HTML <a href="#html">[HTML]</a> Web browsers and XInclude processors are applications that might use XPointer processors.</p></dd><dt class="label">
							[<a name="dt-error" id="dt-error" title="error">Definition</a>: 
								<b>error</b>
							]
						</dt><dd><p>A violation of the syntactic rules of this specification, or the failure of a pointer to identify subresources.</p></dd><dt class="label">
							[<a name="dt-nsbinding" id="dt-nsbinding" title="namespace binding context">Definition</a>: 
								<b>namespace binding context</b>
							]
						</dt><dd><p>A binding of XML-namespace-defined <a href="#XML-Names">[XML-Names]</a> namespace prefixes to their associated namespace names.</p></dd></dl></div></div><div class="div1">
<h2><a name="conformance" id="conformance"></a>2 Conformance</h2><p>This specification defines a framework; it does not currently define a minimum conformance level for XPointer processors. Thus, the information in this section defines conformance requirements only for the framework portion of any minimum conformance level.</p><p>XPointer processors depend on the ability of applications to reverse any fragment identifier encoding and escaping (see <a href="#escaping"><b>4 Character Escaping</b></a>).</p><p>XPointer processor behaviour depends on the availability of certain
information from an XML resource:  in the terms provided by the <a href="#Infoset">[Infoset]</a>, the information items and properties tabulated below may be relevant.  The presence of some of these items and properties depends in turn on conformant DTD or XML Schema processing:  conformant XPointer processors are <em>not</em> required to do such processing, but <em>if</em> they do, shorthand pointer processing will take advantage of the information thus provided (see <a href="#shorthand"><b>3.2 Shorthand Pointer</b></a>).</p><ul><li><p>From the XML Information Set itself <a href="#Infoset">[Infoset]</a>:</p><ul><li><p>
								<a href="http://www.w3.org/TR/xml-infoset/#infoitem.document">document information item</a>
							</p><ul><li><p>
										<b>[document element]</b> property</p><p>Note that if the XML resource is not a document but rather an external parsed entity, this property will not be reported. Rather, the information set is effectively extended to report the one or more top-level elements in the entity as ordered "root element" properties for the entity.</p></li></ul></li><li><p>
								<a href="http://www.w3.org/TR/xml-infoset/#infoitem.element">element information item</a>
							</p><ul><li><p>
										<b>[attributes]</b> property</p></li><li><p>
										<b>[children]</b> property</p></li></ul></li><li><p>
								<a href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">attribute information item</a>
							</p><ul><li><p>
										<b>[attribute type]</b> property</p></li><li><p>
										<b>[normalized value]</b> property</p></li></ul></li></ul></li><li><p>From the XML Schema post-schema validation information set (PSVI)
<a href="#xsd">[XMLSchema]</a>, the following properties of <a href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">attribute information items</a> and <a href="http://www.w3.org/TR/xml-infoset/#infoitem.element">element information items</a>:</p><ul><li><p>
								<b>[schema normalized value]</b> property</p></li><li><p>Either:</p><ul><li><p>
										<b>[member type definition]</b> property</p></li><li><p>
										<b>[type definition]</b> property</p></li><li><p>and the <b>[name]</b>, <b>[target
namespace]</b> and <b>[base type definition]</b> properties of the value thereof</p></li></ul><p>or:</p><ul><li><p>
										<b>[member type definition namespace]</b> property</p></li><li><p>
										<b>[member type definition name]</b> property</p></li><li><p>
										<b>[type definition namespace]</b> property</p></li><li><p>
										<b>[type definition name]</b> property</p></li></ul></li></ul></li></ul><p>Software components claiming to be XPointer processors <a title="Must, May, etc." href="#dt-must">must</a> conform to this XPointer Framework specification and any other specifications that, together with this specification, define the minimum conformance level for XPointer, and <a title="Must, May, etc." href="#dt-must">may</a> conform to additional XPointer scheme specifications. XPointer processors <a title="Must, May, etc." href="#dt-must">must</a> document the additional scheme specifications to which they conform. Specifications that depend on XPointer processing <a title="Must, May, etc." href="#dt-must">should</a> document the schemes they require and support.</p><p>Conforming XPointer processors <a title="Must, May, etc." href="#dt-must">must</a> report XPointer Framework errors to the application. Applications are free to terminate or recover from XPointer Framework errors in any fashion.</p></div><div class="div1">
<h2><a name="language" id="language"></a>3 Language and Processing</h2><p>This section describes the XPointer Framework and the behavior of XPointer processors
with respect to the framework.</p><p>An XPointer processor takes as input an XML resource and a string to be used as a pointer (for example, a fragment identifier, with escaping reversed, taken from the URI reference that was used to access the resource), attempts to evaluate the pointer with respect to the resource, and produces as output an identification of subresources, or one or more errors.</p><div class="div2">
<h3><a name="syntax" id="syntax"></a>3.1 Syntax</h3><p>If a string used as a pointer does not adhere to the syntax defined in this section, it is an error.</p><p>The symbol <a href="http://www.w3.org/TR/REC-xml#NT-S">S</a> is defined in <a href="#XML">[XML]</a>. The symbols <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a> and <a href="http://www.w3.org/TR/REC-xml-names/#NT-QName">QName</a> are defined in <a href="#XML-Names">[XML-Names]</a>.</p>
<h5><a name="bnf" id="bnf"></a>XPointer Framework Syntax</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-Pointer" id="NT-Pointer"></a>[1]&nbsp;&nbsp;&nbsp;</td><td><code>Pointer</code></td><td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td><td><code>
								<a href="#NT-Shorthand">Shorthand</a> | <a href="#NT-SchemeBased">SchemeBased</a>
							</code></td></tr><tr valign="baseline"><td><a name="NT-Shorthand" id="NT-Shorthand"></a>[2]&nbsp;&nbsp;&nbsp;</td><td><code>Shorthand</code></td><td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td><td><code>
								<a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>
							</code></td></tr><tr valign="baseline"><td><a name="NT-SchemeBased" id="NT-SchemeBased"></a>[3]&nbsp;&nbsp;&nbsp;</td><td><code>SchemeBased</code></td><td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td><td><code>
								<a href="#NT-PointerPart">PointerPart</a> (<a href="http://www.w3.org/TR/REC-xml#NT-S">S</a>? <a href="#NT-PointerPart">PointerPart</a>)*</code></td></tr><tr valign="baseline"><td><a name="NT-PointerPart" id="NT-PointerPart"></a>[4]&nbsp;&nbsp;&nbsp;</td><td><code>PointerPart</code></td><td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td><td><code>
								<a href="#NT-SchemeName">SchemeName</a> '(' <a href="#NT-SchemeData">SchemeData</a> ')'</code></td></tr><tr valign="baseline"><td><a name="NT-SchemeName" id="NT-SchemeName"></a>[5]&nbsp;&nbsp;&nbsp;</td><td><code>SchemeName</code></td><td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td><td><code>
								<a href="http://www.w3.org/TR/REC-xml-names/#NT-QName">QName</a>
							</code></td></tr><tr valign="baseline"><td><a name="NT-SchemeData" id="NT-SchemeData"></a>[6]&nbsp;&nbsp;&nbsp;</td><td><code>SchemeData</code></td><td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td><td><code>
								<a href="#NT-EscapedData">EscapedData</a>*
							</code></td></tr><tr valign="baseline"><td><a name="NT-EscapedData" id="NT-EscapedData"></a>[7]&nbsp;&nbsp;&nbsp;</td><td><code>EscapedData</code></td><td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td><td><code>
								<a href="#NT-NormalChar">NormalChar</a> | '^(' | '^)' | '^^' | '(' <a href="#NT-SchemeData">SchemeData</a> ')'
							</code></td></tr><tr valign="baseline"><td><a name="NT-NormalChar" id="NT-NormalChar"></a>[8]&nbsp;&nbsp;&nbsp;</td><td><code>NormalChar</code></td><td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td><td><code>
								<a href="#NT-UnicodeChar">UnicodeChar</a> - [()^]
							</code></td></tr><tr valign="baseline"><td><a name="NT-UnicodeChar" id="NT-UnicodeChar"></a>[9]&nbsp;&nbsp;&nbsp;</td><td><code>UnicodeChar</code></td><td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td><td><code>
								[#x0-#x10FFFF]
							</code></td></tr></tbody></table><p>As shown in the above productions, the end of a pointer part is signaled by the right parenthesis "<code>)</code>" character that balances the left parenthesis "<code>(</code>" character that began the part. If either a left or a right parenthesis occurs in scheme data without being balanced by its counterpart, it <a title="Must, May, etc." href="#dt-must">must</a> be escaped with a circumflex (<code>^</code>) character preceding it. Escaping pairs of balanced parentheses is allowed. Any literal occurrences of the circumflex <a title="Must, May, etc." href="#dt-must">must</a> be escaped with an additional circumflex (that is, <code>^^</code>). Any other use of a circumflex is an error.</p></div><div class="div2">
<h3><a name="shorthand" id="shorthand"></a>3.2 Shorthand Pointer</h3><p>A shorthand pointer, formerly known as a barename, consists of an <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a> alone.  It identifies at most one element in the resource's information set; specifically, the first one (if any) in document order that has a matching <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a> as an identifier.  The identifiers of an element are determined as follows:</p><ol type="1"><li><p>If an element information item has an attribute information item
among its <b>[attributes]</b> that is a <a title="schema-determined ID" href="#term-sdi">schema-determined ID</a>,
then it is identified by the value of that attribute information item's <b>[schema normalized
value]</b> property;</p></li><li><p>If an element information item has an element information item
among its <b>[children]</b> that is a <a title="schema-determined ID" href="#term-sdi">schema-determined ID</a>,
then it is identified by the value of that element information item's <b>[schema normalized
value]</b> property;</p></li><li><p>If an element information item has an attribute information item
among its <b>[attributes]</b> that is a <a title="DTD-determined ID" href="#term-ddi">DTD-determined ID</a>,
then it is identified by the value of that attribute information item's <b>[normalized
value]</b> property.</p></li><li><p>An element information item may also be identified by an <a title="externally-determined ID" href="#term-xdi">externally-determined ID</a> value.</p></li></ol><p>If no element information item is identified by a shorthand pointer's <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>, the pointer is in error.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>An element information item might be identified by multiple values, in a document with more than one of <a title="DTD-determined ID" href="#term-ddi">DTD-determined IDs</a>, <a title="schema-determined ID" href="#term-sdi">schema-determined IDs</a>, and <a title="externally-determined ID" href="#term-xdi">externally-determined IDs</a>.  In such documents, a loss of interoperability might result if the identifier values for a particular element are not always the same.</p></div><p>
					[<a name="term-sdi" id="term-sdi" title="schema-determined ID">Definition</a>: An element or
attribute information item is a <b>schema-determined ID</b> if and only
if one of the following is true:]</p><ol type="1"><li><p>It has a <b>[member type definition]</b> or <b>[type
definition]</b> property whose value in turn 
has <b>[name]</b> equal to <code>ID</code> and <b>[target namespace]</b> equal to <code>http://www.w3.org/2001/XMLSchema</code>;</p></li><li><p>It
has a <b>[base type definition]</b> whose value has that <b>[name]</b> and <b>[target namespace]</b>;</p></li><li><p>It has a
<b>[base type definition]</b> whose value has a <b>[base type
definition]</b> whose value has that <b>[name]</b> and
<b>[target namespace]</b>, and so on following the <b>[base type
definition]</b> property recursively;</p></li><li><p>It has a <b>[type
definition name]</b> equal to <code>ID</code>
and a <b>[type definition namespace]</b> equal to
<code>http://www.w3.org/2001/XMLSchema</code>;</p></li><li><p>It has a <b>[member type definition name]</b> equal to <code>ID</code>
and a <b>[member type definition namespace]</b> equal to <code>http://www.w3.org/2001/XMLSchema</code>.</p></li></ol><p>[<a name="term-ddi" id="term-ddi" title="DTD-determined ID">Definition</a>: An
attribute information item is a <b>DTD-determined ID</b> if and only
if it has a <b>[type definition]</b> property whose value is equal to <code>ID</code>.]
				</p><p>[<a name="term-xdi" id="term-xdi" title="externally-determined ID">Definition</a>: An <b>externally-determined ID</b> is a string, representing an element identifier, whose value is determined by the application through mechanisms outside the scope of this specification.]</p><div class="note"><p class="prefix"><b>Note:</b></p><p>A shorthand pointer provides, for resources with XML-based media types,
a rough analog of HTML fragment identifier behavior. However, if <b>ID</b> typing
information is not available because no DTD, schema, or application-specific information is available,
the pointer will not identify any element. There are several ways to make
element identification more reliable. For example, the creator of a resource
can use an internal DTD subset to indicate the presence of ID-typed attributes,
and the creator of a pointer can, instead of a shorthand pointer, use a scheme-based
pointer or provide one or more schemes that address the desired element in
other ways.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>The above definitions are <em>not</em> affected by whether or not the value which identified an element information item is unique within the document, because neither <a href="#XML">[XML]</a> or <a href="#xsd">[XMLSchema]</a> require this for the assignment of type ID.</p></div></div><div class="div2">
<h3><a name="scheme" id="scheme"></a>3.3 Scheme-Based Pointer</h3><p>A scheme-based pointer consists of one or more pointer parts, optionally separated by white space (<a href="http://www.w3.org/TR/REC-xml#NT-S">S</a>). Each part has a scheme name and contains, within parentheses, data (<a href="#NT-EscapedData">EscapedData</a>) conforming to the named scheme. If the scheme data contains parentheses, they <a title="Must, May, etc." href="#dt-must">must</a> be either balanced or escaped.</p><p>When multiple pointer parts are provided, an XPointer processor <a title="Must, May, etc." href="#dt-must">must</a> evaluate them in left-to-right order.  If the XPointer processor does not support the scheme used in a pointer part, it skips that pointer part.  If a pointer part does not identify any subresources, evaluation continues and the next pointer part, if any, is evaluated. The result of the first pointer part whose evaluation identifies one or more subresources is reported by the XPointer processor as the result of the pointer as a whole, and evaluation stops.  If no pointer part identifies subresources, it is an error.</p><p>In the following example, if the 'xpointer' pointer part is not understood or fails to identify any subresources, the 'element' pointer part is evaluated.  If the 'xpointer' pointer part identifies subresources, the 'element' pointer part is not evaluated.</p><div class="exampleInner"><pre>#xpointer(id('boy-blue')/horn[1])element(boy-blue/3)</pre></div><p>A scheme name consists syntactically of an optional <a href="http://www.w3.org/TR/REC-xml-names/#NT-Prefix">Prefix</a> and a <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">LocalPart</a>, as defined in <a href="#XML-Names">[XML-Names]</a>.  Abstractly, scheme names are a tuple consisting of the <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">LocalPart</a> and the <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace name</a> corresponding to that <a href="http://www.w3.org/TR/REC-xml-names/#NT-Prefix">Prefix</a> in the <a title="namespace binding context" href="#dt-nsbinding">namespace binding context</a>.  If the namespace binding context contains no corresponding prefix, or if the (<a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace name</a>, <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">LocalPart</a>) pair does not correspond to a scheme name supported by the XPointer processor, the pointer part is skipped.</p><p>This specification reserves all unqualified scheme names for definition in additional XPointer schemes defined in W3C Recommendations. The use of <a href="http://www.w3.org/TR/REC-xml-names/#NT-QName">QNames</a> as scheme names provides a general framework for extensibility by other XML-based media types wishing to use this framework in defining their own fragment identifier languages.  The definition of any scheme to be used in conjunction with the XPointer framework <a title="Must, May, etc." href="#dt-must">must</a> specify a name for the scheme, consisting of a (<a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace name</a>, <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">LocalPart</a>) pair.</p></div><div class="div2">
<h3><a name="nsContext" id="nsContext"></a>3.4 Namespace Binding Context</h3><p>Scheme specifications <a title="Must, May, etc." href="#dt-must">may</a> define ways to bind XML namespaces <a href="#XML-Names">[XML-Names]</a> prefixes to namespace names for the purpose of interpreting the prefixes of scheme names, or element names, attribute names and other <a href="http://www.w3.org/TR/REC-xml-names/#NT-QName">QNames</a> appearing in pointer parts. These bindings contribute to a namespace binding context that applies to all pointer parts to the right of the pointer part making the binding, unless exceptions are explicitly made by the schemes in question. The documentation for any namespace-binding scheme <a title="Must, May, etc." href="#dt-must">must</a> specify whether its bindings remain in effect for later pointer parts. The documentation for every scheme <a title="Must, May, etc." href="#dt-must">must</a> specify whether it uses the namespace binding context.</p><p>In the following example, the 'xmlns' scheme (see <a href="#xptr-xmlns">[XPtrXmlns]</a>) is used to add a (prefix/namespace name) binding to the namespace binding context.  The XPointer processor uses this information to ascertain whether <code>img:rect</code> denotes the name of a scheme that it supports.</p><div class="exampleInner"><pre>#xmlns(img=http://example.org/image)img:rect(10,10,50,50)</pre></div><p>The initial namespace binding context prior to evaluation of the first pointer part consists of a single entry: the <code>xml</code> prefix bound to the namespace name <code>http://www.w3.org/XML/1998/namespace</code>. The namespace binding context is subject to the following constraints; attempts to violate these constraints will have no effect on the namespace binding context:</p><ul><li><p>The <code>xml</code> prefix is bound to the namespace name <code>http://www.w3.org/XML/1998/namespace</code>.  It <a title="Must, May, etc." href="#dt-must">must not</a> be bound to any other namespace name.</p></li><li><p>The namespace name <code>http://www.w3.org/XML/1998/namespace</code> is bound to the prefix <code>xml</code>.  It <a title="Must, May, etc." href="#dt-must">must not</a> be bound to any other prefix.</p></li><li><p>The <code>xmlns</code> prefix <a title="Must, May, etc." href="#dt-must">must not</a> be bound to a namespace name.</p></li><li><p>The namespace name <code>http://www.w3.org/2000/xmlns/</code>	<a title="Must, May, etc." href="#dt-must">must not</a> be bound to any prefix.</p></li></ul><p>Prefixes beginning with the three-letter sequence x, m, l, in any case combination, are reserved. Users <a title="Must, May, etc." href="#dt-must">should not</a> use them except as defined by XML and XML-related specifications.</p></div></div><div class="div1">
<h2><a name="escaping" id="escaping"></a>4 Character Escaping</h2><p>The set of characters for XPointers is <a href="#unicode">[Unicode]</a>.  However, the XPointer language is designed to be used in the context of URI references <a href="#rfc2396">[RFC 2396]</a> and IRI references <a href="#iri">[IRI]</a>, which require encoding and escaping of certain characters. XPointers and IRI references containing XPointers also often appear in XML documents and external parsed entities, which impose some escaping requirements of their own when the encoding limits the repertoire that can be used directly.  Other contexts might require additional escaping to be applied to XPointers.  Also, because some characters are significant to XPointer processing, escaping is needed to use these characters in their ordinary sense.</p><div class="div2">
<h3><a name="escapingModel" id="escapingModel"></a>4.1 Escaping Contexts</h3><p>The following contexts require various types of escaping to be applied to XPointers:</p><dl><dt class="label">A. Escaping of XPointer-significant characters</dt><dd><p>As described in <a href="#syntax"><b>3.1 Syntax</b></a>, unbalanced parentheses and occurrences of the circumflex <a title="Must, May, etc." href="#dt-must">must</a> be escaped.</p></dd><dt class="label">B. Escaping and Encoding of reserved IRI characters</dt><dd><p>
								[<a name="dt-iri" id="dt-iri" title="Internationalized Resource Identifier">Definition</a>: An <b>Internationalized Resource Identifier</b>, or IRI is a protocol element that extends the syntax of URIs to a much wider repertoire of Unicode characters <a href="#unicode">[Unicode]</a>.] IRI references allow a superset of the characters of fully escaped URI references, but <a title="Must, May, etc." href="#dt-must">must</a> have normal occurrences of the percent sign (<code>%</code>) escaped because it is the character used for escaping in URIs and IRIs.</p><p>Thus, when a pointer is inserted into an IRI reference, any occurrences of percent signs (<code>%</code>) <a title="Must, May, etc." href="#dt-must">must</a> be escaped.  Other characters <a title="Must, May, etc." href="#dt-must">may</a> be escaped as well, though it is not recommended.  Characters are escaped as follows:</p><ol type="1"><li><p>Each character to be escaped is converted to UTF-8 <a href="#rfc2279">[RFC 2279]</a> as one or more bytes.</p></li><li><p>The resulting bytes are escaped with the URI escaping mechanism (that is, converted to %HH, where HH is the hexadecimal notation of the byte value).</p></li><li><p>The original character is replaced by the resulting character sequence.</p></li></ol><p>For example <code>%</code> becomes <code>%25</code>.</p></dd><dt class="label">C. Escaping and Encoding of reserved URI characters</dt><dd><p>IRI references can be converted to URI references for consumption by URI resolvers.  The disallowed characters in URI references include all non-ASCII characters, plus the excluded characters listed in Section 2.4 of <a href="#rfc2396">[RFC 2396]</a>, except for the number sign (#) and percent sign (%) and the square bracket characters re-allowed in <a href="#rfc2732">[RFC 2732]</a>.  Disallowed characters are escaped as follows:</p><ol type="1"><li><p>Each disallowed character is converted to UTF-8 <a href="#rfc2279">[RFC 2279]</a> as one or more bytes.</p></li><li><p>The resulting bytes are escaped with the URI escaping mechanism (that is, converted to %HH, where HH is the hexadecimal notation of the byte value).</p></li><li><p>The original character is replaced by the resulting character sequence.</p></li></ol></dd><dt class="label">D. XML escaping</dt><dd><p>If a pointer appears in an XML document or external parsed entity, any characters not expressible in the encoding used <a title="Must, May, etc." href="#dt-must">must</a> be escaped as character references, and any characters that are significant to XML processing at the point where they appear <a title="Must, May, etc." href="#dt-must">must</a> be escaped by an appropriate mechanism such as character references or entity references. This escaping is reversed when the XML document or entity is parsed.  It is not recommended that URI references (rather than the more general IRI references) be placed in XML documents.  If for some reason this proves unavoidable, the same escaping mechanism applies.</p></dd></dl><p>Since the XPointer processor will reverse only the escaping of XPointer-significant characters (A), the application must reverse any other encodings or escapings (such as B, C, or D) that the pointer was subject to.  If the result passed to the XPointer processor does not conform to the syntactic rules for XPointers in this specification, it is an error.</p></div><div class="div2">
<h3><a name="escExamples" id="escExamples"></a>4.2 Examples of Escaping</h3><p>The following table shows the escaping in various contexts of an XPointer containing an unbalanced parenthesis, double quotation marks, and spaces. These examples use the 'xpointer' scheme (see <a href="#xptr-xpointer">[XPtrXPointer]</a>), since it allows string literals in its scheme data.</p><table border="1" frame="border" summary="Escaping examples"><thead><tr><th colspan="1" rowspan="1">Context</th><th colspan="1" rowspan="1">Notation</th></tr></thead><tbody><tr><td colspan="1" rowspan="1">Initial Scheme Data</td><td colspan="1" rowspan="1">The <code>xpointer</code> scheme data as it was initially created: <div class="exampleInner"><pre>string-range(//P,"my favorite smiley :-)")</pre></div>
							</td></tr><tr><td colspan="1" rowspan="1">A.&nbsp;XPointer</td><td colspan="1" rowspan="1">With the unbalanced parenthesis in the scheme data escaped, as required by this specification: <div class="exampleInner"><pre>xpointer(string-range(//P,"my favorite smiley :-^)"))</pre></div>
							</td></tr><tr><td colspan="1" rowspan="1">B.&nbsp;Pointer in IRI reference</td><td colspan="1" rowspan="1">Same as A (no percent sign found that needs escaping): <div class="exampleInner"><pre>#xpointer(string-range(//P,"my favorite smiley :-^)"))</pre></div>
							</td></tr><tr><td colspan="1" rowspan="1">C.&nbsp;IRI reference converted to URI reference</td><td colspan="1" rowspan="1">With occurrences of the double quotatation marks (<code>%22</code>), spaces
(<code>%20</code>), and circumflexes (<code>%5E</code>) escaped:<div class="exampleInner"><pre>#xpointer(string-range(//P,%22my%20favorite%20smiley%20:-%5E)%22))</pre></div>
							</td></tr><tr><td colspan="1" rowspan="1">D.&nbsp;IRI reference in XML document</td><td colspan="1" rowspan="1">Double quotation marks escaped using XML's predefined <code>&amp;quot;</code> entity reference (assuming that the pointer appears in an IRI reference in a double-quoted attribute value): <div class="exampleInner"><pre>#xpointer(string-range(//P,&amp;quot;my favorite smiley :-^)&amp;quot;))</pre></div>
							</td></tr></tbody></table><p>The following table shows the escaping of an XPointer containing accented characters in various contexts. The XML document is assumed to be encoded in <code>US-ASCII</code>, which does not allow the letter "&eacute;" to appear directly.</p><table border="1" frame="border" summary="Escaping examples"><thead><tr><th colspan="1" rowspan="1">Context</th><th colspan="1" rowspan="1">Notation</th></tr></thead><tbody><tr><td colspan="1" rowspan="1">Initial Scheme Data</td><td colspan="1" rowspan="1">The <code>xpointer</code> scheme data as it was initially created:<div class="exampleInner"><pre>id('r&eacute;sum&eacute;')</pre></div>
							</td></tr><tr><td colspan="1" rowspan="1">A.&nbsp;XPointer</td><td colspan="1" rowspan="1">The XPointer (no circumflexes or unbalanced parentheses in scheme data that need escaping):<div class="exampleInner"><pre>xpointer(id('r&eacute;sum&eacute;'))</pre></div>
							</td></tr><tr><td colspan="1" rowspan="1">B.&nbsp;Pointer in IRI reference</td><td colspan="1" rowspan="1">Same as A (no percent sign found that needs escaping):<div class="exampleInner"><pre>#xpointer(id('r&eacute;sum&eacute;'))</pre></div>
							</td></tr><tr><td colspan="1" rowspan="1">C.&nbsp;IRI reference converted to URI reference</td><td colspan="1" rowspan="1">With occurrences of the letter "&eacute;" (<code>%C3%A9</code>) escaped:<div class="exampleInner"><pre>#xpointer(id('r%C3%A9sum%C3%A9'))</pre></div>
							</td></tr><tr><td colspan="1" rowspan="1">D.&nbsp;IRI reference in XML document</td><td colspan="1" rowspan="1">Represented in the <code>US-ASCII</code> encoding; accented letters are escaped with XML character references:<div class="exampleInner"><pre>#xpointer(id('r&amp;#xE9;sum&amp;#xE9;'))</pre></div>
							</td></tr></tbody></table></div></div></div><div class="back"><div class="div1">
<h2><a name="references" id="references"></a>A References</h2><div class="div2">
<h3><a name="normRefs" id="normRefs"></a>A.1 Normative References</h3><dl><dt class="label"><a name="Infoset" id="Infoset"></a>Infoset</dt><dd>
						John Cowan and Richard Tobin, editors.
						<a href="http://www.w3.org/TR/xml-infoset/"><cite>XML Information Set</cite></a>.
						World Wide Web Consortium, 2001.
					</dd><dt class="label"><a name="rfc2119" id="rfc2119"></a>RFC 2119</dt><dd>
						Scott Bradner, 
						<a href="http://www.rfc-editor.org/rfc/rfc2119.txt"><cite>RFC 2119: Key words for use in RFCs to Indicate Requirement Levels</cite></a>.
						Internet Engineering Task Force, 1997.
					</dd><dt class="label"><a name="rfc2396" id="rfc2396"></a>RFC 2396</dt><dd>
						Tim Berners-Lee, Roy Fielding, and Larry Masinter,
						<a href="http://www.rfc-editor.org/rfc/rfc2396.txt"><cite>RFC 2396: Uniform Resource Identifiers</cite></a>.
						Internet Engineering Task Force, 1995.
					</dd><dt class="label"><a name="rfc2732" id="rfc2732"></a>RFC 2732</dt><dd>
						Robert Hinden, Brian Carpenter, and Larry Masinter,
						<a href="http://www.rfc-editor.org/rfc/rfc2732.txt"><cite>RFC 2732: Format for Literal IPv6 Addresses in URL's</cite></a>.
						Internet Engineering Task Force, 1999.
					</dd><dt class="label"><a name="rfc2279" id="rfc2279"></a>RFC 2279</dt><dd>
						Fran&ccedil;ois Yergeau
						<a href="http://www.rfc-editor.org/rfc/rfc2279.txt"><cite>RFC 2279: UTF-8, a transformation format of ISO 10646</cite></a>.
						Internet Engineering Task Force, 1998.
					</dd><dt class="label"><a name="draft-xmlmediatypes" id="draft-xmlmediatypes"></a>RFC 3023</dt><dd>
						MURATA Makoto, Simon St.Laurent, and Dan Kohn,
						<a href="http://www.rfc-editor.org/rfc/rfc3023.txt"><cite>RFC 3023: XML Media Types</cite></a>.
						Internet Engineering Task Force, 2001.
					</dd><dt class="label"><a name="XML" id="XML"></a>XML</dt><dd>
						Tim Bray, Jean Paoli, C.M. Sperberg-McQueen, and Eve Maler, editors.
						<a href="http://www.w3.org/TR/REC-xml"><cite>Extensible Markup Language (XML) 1.0 (Second Edition).</cite></a> 
						World Wide Web Consortium, 2000.
					</dd><dt class="label"><a name="XML-Names" id="XML-Names"></a>XML-Names</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.
					</dd><dt class="label"><a name="xsd" id="xsd"></a>XMLSchema</dt><dd>
						Henry Thompson et al., editors. 
						<a href="http://www.w3.org/TR/xmlschema-1/"><cite>XML Schema Part 1.</cite></a> 
						World Wide Web Consortium, 2001.
					</dd><dt class="label"><a name="unicode" id="unicode"></a>Unicode</dt><dd>
						The Unicode Consortium
						<a href="http://www.unicode.org/unicode/standard/standard.html"><cite>The Unicode Standard</cite></a>.
					</dd></dl></div><div class="div2">
<h3><a name="nonnormRef" id="nonnormRef"></a>A.2 Non-Normative References</h3><dl><dt class="label"><a name="html" id="html"></a>HTML</dt><dd>
						Dave Raggett, Arnaud Le Hors, and Ian Jacobs.
						<a href="http://www.w3.org/TR/html4/"><cite>HTML 4.01 Specification</cite></a>. 
						World Wide Web Consortium, 1999.</dd><dt class="label"><a name="iri" id="iri"></a>IRI</dt><dd>
						Martin J. D&uuml;rst and Michel Suignard
						<a href="http://www.w3.org/International/2002/draft-duerst-iri-01.txt"><cite>Internationalized Resource Identifiers (IRI)</cite></a>
						Internet draft draft-duerst-iri-01, Internet Engineering Task Force, 2002. <em>Work in progress.</em>
					</dd><dt class="label"><a name="rdf" id="rdf"></a>RDF</dt><dd>
						Dave Beckett, editor. 
						<a href="http://www.w3.org/TR/REC-rdf-syntax/"><cite>RDF/XML Syntax Specification</cite></a>. 
						World Wide Web Consortium, 2001.
					</dd><dt class="label"><a name="soap12" id="soap12"></a>SOAP12</dt><dd>
						Nilo Mitra et al., editors.
						<a href="http://www.w3.org/TR/soap12-part0/"><cite>SOAP Version 1.2</cite></a> 
						Parts 0, 1, and 2. World Wide Web Consortium, 2001. <em>Work in progress.</em>
					</dd><dt class="label"><a name="xinclude" id="xinclude"></a>XInclude</dt><dd>
						Jonathan Marsh and David Orchard, editors. 
						<a href="http://www.w3.org/TR/xinclude/"><cite>XML Inclusions (XInclude) Version 1.0</cite></a>. 
						<em>Work in progress.</em> World Wide Web Consortium, 2001.
					</dd><dt class="label"><a name="XLink" id="XLink"></a>XLink</dt><dd>
						Steve DeRose, Eve Maler, and David Orchard, editors. 
						<a href="http://www.w3.org/TR/xlink/"><cite>XML Linking Language (XLink)</cite></a>. 
						World Wide Web Consortium, 2001.
					</dd><dt class="label"><a name="xptr-xmlns" id="xptr-xmlns"></a>XPtrXmlns</dt><dd>
						Paul Grosso, Eve Maler, Jonathan Marsh, and Norman Walsh, editors. 
						<a href="http://www.w3.org/TR/xptr-xmlns/"><cite>XPointer xmlns() Scheme</cite></a>. 
						World Wide Web Consortium, 2003.</dd><dt class="label"><a name="xptr-xpointer" id="xptr-xpointer"></a>XPtrXPointer</dt><dd>
						Steven DeRose, Eve Maler, and Ron Daniel Jr., editors. 
						<a href="http://www.w3.org/TR/xptr-xpointer/"><cite>XPointer xpointer() Scheme</cite></a>. 
						World Wide Web Consortium, 2002.  <em>Work in progress.</em>
					</dd></dl></div></div></div></body></html>