<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type="text/xsl" href="xmlspec.xsl"?>
<!DOCTYPE spec PUBLIC "-//W3C//DTD Specification V2.1//EN" "xmlspec.dtd" [
	<!ENTITY abstract "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 &media-types;. Other XML-based media types are also encouraged to use this framework in defining their own fragment identifier languages.">
	<!ENTITY day "13">
	<!ENTITY month "November">
	<!ENTITY monthno "11">
	<!ENTITY year "2002">
	<!ENTITY trpath "http://www.w3.org/TR/">
	<!ENTITY W3C-path "&trpath;&year;/">
	<!ENTITY doctype "PR">
	<!ENTITY framework "XPointer Framework">
	<!ENTITY shortname "framework">
	<!ENTITY isodate "&year;&monthno;&day;">
	<!ENTITY dirname "&W3C-path;&doctype;-xptr-&shortname;-&isodate;/">
	<!ENTITY infoset "http://www.w3.org/TR/xml-infoset">
	<!ENTITY Note "Note">
	<!ENTITY media-types "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>">
	<!ENTITY XML "http://www.w3.org/TR/REC-xml">
	<!ENTITY XMLNames "http://www.w3.org/TR/REC-xml-names/">
]>
<spec w3c-doctype="pr">
	<header>
		<title>XPointer Framework</title>
		<w3c-designation>&doctype;-xptr-&shortname;-&isodate;</w3c-designation>
		<w3c-doctype>W3C Proposed Recommendation</w3c-doctype>
		<pubdate>
			<day>&day;</day>
			<month>&month;</month>
			<year>&year;</year>
		</pubdate>
		<publoc>
			<loc href="&dirname;">&dirname;</loc>
		</publoc>
		<altlocs>
			<loc href="&dirname;xptr-framework.xml">XML</loc>
		</altlocs>
		<latestloc>
			<loc href="&trpath;xptr-&shortname;/">&trpath;xptr-&shortname;/</loc>
		</latestloc>
		<prevlocs>
			<loc href="http://www.w3.org/TR/2002/WD-xptr-framework-20020710/">http://www.w3.org/TR/2002/WD-xptr-framework-20020710/</loc>
			<!--
			<loc href="http://www.w3.org/TR/2001/CR-xptr-20010911/">http://www.w3.org/TR/2001/CR-xptr-20010911/</loc>
-->
		</prevlocs>
		<!-- <otherlocs>This document is also available in the
 following non-normative format:
  <loc href="&dirname;&shortname;.xml">XML</loc>
 (<loc href="&dirname;xmlspec.dtd">DTD</loc>,
  <loc href="&dirname;xmlspec.xsl">XSL</loc>).
 </otherlocs>
-->
		<authlist>
			<author>
				<name>Paul Grosso</name>
				<affiliation>Arbortext, Inc.</affiliation>
				<email href="mailto:paul@arbortext.com">paul@arbortext.com</email>
			</author>
			<author>
				<name>Eve Maler</name>
				<affiliation>Sun Microsystems</affiliation>
				<email href="mailto:eve.maler@sun.com">eve.maler@sun.com</email>
			</author>
			<author>
				<name>Jonathan Marsh</name>
				<affiliation>Microsoft</affiliation>
				<email href="mailto:jmarsh@microsoft.com">jmarsh@microsoft.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>
		<abstract>
			<p>&abstract;</p>
		</abstract>
		<status>
			<p>This document is a <loc href="http://www.w3.org/Consortium/Process-20010719/#RecsPR">Proposed Recommendation (PR)</loc> of the W3C.	This document has been produced by the <loc href="http://www.w3.org/XML/Linking">W3C XML Linking Working Group</loc> as part of the <loc href="http://www.w3.org/XML/Activity">XML Activity</loc>.  It is intended to address a core subset of the original <loc href="http://www.w3.org/TR/NOTE-xptr-req">XPointer requirements</loc>, and to serve as all or a foundational part of a recommendation to the IETF for a fragment identifier syntax for the XML Mime types.</p>
			<p>W3C Advisory Committee Members are invited to send formal review comments
to the W3C Team until 13 December 2002 at <loc href="mailto:team-xptr-review@w3.org">team-xptr-review@w3.org</loc>.  The public is invited to send comments to the public mailing list <loc href="mailto:www-xml-linking-comments@w3.org">www-xml-linking-comments@w3.org</loc> (<loc href="http://lists.w3.org/Archives/Public/www-xml-linking-comments/">archive</loc>). After the review the Director will announce the document's disposition. This announcement should not be expected sooner than 14 days after the end of the review.</p>
			<p>This document is based upon the <loc href="http://www.w3.org/TR/2001/CR-xptr-20010911/">XPointer Candidate Recommendation</loc> published on 11 September 2001.  Feedback received during that review and a lack of a sufficient number of complete implementations led the Working Group to factor the basic functionality specified there into four specifications: the XPointer Framework (this specification), the <loc href="http://www.w3.org/TR/xptr-element/">XPointer element() Scheme</loc>, the <loc href="http://www.w3.org/TR/xptr-xmlns/">XPointer xmlns() scheme</loc>, and the <loc href="http://www.w3.org/TR/xptr-xpointer/">XPointer xpointer() scheme</loc>.  This specification subsequently went through an additional <loc href="http://www.w3.org/TR/2002/WD-xptr-framework-20020710/">Last Call</loc> period.  The XML Linking Working Group believes that this specification addresses all relevant Last Call and Candidate Recommendation issues, and represents an interoperable subset of the implementations documented in the <loc href="http://www.w3.org/XML/2000/09/LinkingImplementations.html">previous Implementation Report</loc>, and thus that a further Candidate Recommendation period is not necessary.  Information about more recent implementations of subsets relevant to this specification and the <loc href="http://www.w3.org/TR/xptr-element/">XPointer element() Scheme</loc> and <loc href="http://www.w3.org/TR/xptr-xmlns/">XPointer xmlns() scheme</loc> can be found in the <loc href="http://www.w3.org/XML/2002/10/LinkingImplementations.html">new Implementation Report</loc>.  Other specifications such as <loc href="http://www.w3.org/TR/xinclude/">XInclude 1.0</loc> already make normative references to this specification, which makes timely progression to Recommendation desirable.</p>
			<p>There are patent disclosures and license commitments associated with
this working draft, which may be found on the <loc href="http://www.w3.org/2002/06/xptr_IPR_summary.html">XPointer IPR Statement</loc> page in conformance with <loc href="http://www.w3.org/Consortium/Process-20010719/#ipr">W3C policy</loc>.</p>
			<p>Publication as a Proposed Recommendation does not imply endorsement by the W3C membership. This is still a draft document and may be updated, replaced or made obsolete by other documents at any time. It is inappropriate to cite a W3C Proposed Recommendation as other than a "work in progress." A list of current W3C Recommendations and other technical documents can be found at <loc href="http://www.w3.org/TR/">http://www.w3.org/TR/</loc>.</p>
		</status>
		<langusage>
			<language id="en">English</language>
			<language id="ebnf">Extended Backus-Naur Form (formal grammar)</language>
		</langusage>
		<revisiondesc>
			<slist>
				<sitem>20020404: Initial draft of the framework portion of the specification.</sitem>
				<sitem>20020411: Second draft. Extended Status text a little, removed editorial
notes, and made Conformance text simpler regarding minimum conformance levels.
Slight further cleanup of the distinction between failure and errors.</sitem>
				<sitem>20020417: Third draft. Incorporates wording changes decided at today's
telecon (more changes are outstanding) and attempts a more finalized Status
of This Document, assuming that we are going to make this a last-call WD rather
than a CR update.</sitem>
				<sitem>20020425: Fourth draft. Incorporates wording changes decided at yesterday's
telecon: new requirements on documentation for namespace-binding schemes and
schemes that use them, and last-call context information in status.</sitem>
				<sitem>20020501: Fifth draft. More heavily encouraged the reuse of the framework
in other XML-based media types. Change Char+ to Char* (plus associated prose
changes).</sitem>
				<sitem>20020508: Sixth draft. Added a new second step in schema ID recognition
that accounts for minimally conforming schema processors, added the word <quote>recursively</quote> to
2(b), and added explanatory text to the note on potential failures of ID-based
addressing. The Working Group voted to publish this draft.</sitem>
				<sitem>20020511: Seventh draft. Editorial cleanup suggested by Ron and Jonathan.</sitem>
				<sitem>20020518: Eighth draft. Added text to Status section to set expectations
better.</sitem>
				<sitem>20020522: Ninth draft. Incorporated editorial changes agreed on in
today's telecon, plus a few items pointed out in private communications.</sitem>
			</slist>
		</revisiondesc>
	</header>
	<body>
		<div1 id="introduction">
			<head>Introduction</head>
			<p>&abstract;</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 <bibref ref="XLink"/>, XML Inclusions <bibref ref="xinclude"/>, the Resource Description Framework <bibref ref="rdf"/>, and SOAP 1.2 <bibref ref="soap12"/>. 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>
			<div2 id="notation">
				<head>Notation</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>The formal grammar for the &framework; is given using simple Extended Backus-Naur Form (EBNF) notation, as described in the XML Recommendation <bibref ref="XML"/>.</p>
			</div2>
			<div2 id="terminology">
				<head>Terminology</head>
				<glist>
					<gitem>
						<label>
							<termdef id="dt-pointer" term="pointer">
								<term>pointer</term>
							</termdef>
						</label>
						<def>
							<p>A string conforming to this specification. This specification defines the syntax and semantics of pointers.</p>
						</def>
					</gitem>
					<gitem>
						<label>
							<termdef id="dt-pointerpart" term="pointer part">
								<term>pointer part</term>
							</termdef>
						</label>
						<def>
							<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>
						</def>
					</gitem>
					<gitem>
						<label>
							<termdef id="dt-scheme" term="scheme">
								<term>scheme</term>
							</termdef>
						</label>
						<def>
							<p>A specialized pointer data format that has a name and is defined in a specification.</p>
						</def>
					</gitem>
					<gitem>
						<label>
							<termdef id="dt-processor" term="XPointer processor">
								<term>XPointer processor</term>
							</termdef>
						</label>
						<def>
							<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>
						</def>
					</gitem>
					<gitem>
						<label>
							<termdef id="dt-app" term="application">
								<term>application</term>
							</termdef>
						</label>
						<def>
							<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 <bibref ref="html"/> Web browsers and XInclude processors are applications that might use XPointer processors.</p>
						</def>
					</gitem>
					<gitem>
						<label>
							<termdef id="dt-error" term="error">
								<term>error</term>
							</termdef>
						</label>
						<def>
							<p>A violation of the syntactic rules of this specification, or the failure of a pointer to identify subresources.</p>
						</def>
					</gitem>
					<gitem>
						<label>
							<termdef id="dt-nsbinding" term="namespace binding context">
								<term>namespace binding context</term>
							</termdef>
						</label>
						<def>
							<p>A binding of XML-namespace-defined <bibref ref="XML-Names"/> namespace prefixes to their associated namespace names.</p>
						</def>
					</gitem>
				</glist>
			</div2>
		</div1>
		<div1 id="conformance">
			<head>Conformance</head>
			<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 <specref ref="escaping"/>).</p>
			<p>XPointer processor behaviour depends on the availability of certain
information from an XML resource:  in the terms provided by the <bibref ref="Infoset"/>, 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 <emph>not</emph> required to do such processing, but <emph>if</emph> they do, shorthand pointer processing will take advantage of the information thus provided (see <specref ref="shorthand"/>).</p>
			<ulist>
				<item>
					<p>From the XML Information Set itself <bibref ref="Infoset"/>:</p>
					<ulist>
						<item>
							<p>
								<xtermref href="&infoset;/#infoitem.document">document information item</xtermref>
							</p>
							<ulist>
								<item>
									<p>
										<kw>[document element]</kw> 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 <quote>root element</quote> properties for the entity.</p>
								</item>
							</ulist>
						</item>
						<item>
							<p>
								<xtermref href="&infoset;/#infoitem.element">element information item</xtermref>
							</p>
							<ulist>
								<item>
									<p>
										<kw>[attributes]</kw> property</p>
								</item>
								<item>
									<p>
										<kw>[children]</kw> property</p>
								</item>
							</ulist>
						</item>
						<item>
							<p>
								<xtermref href="&infoset;/#infoitem.attribute">attribute information item</xtermref>
							</p>
							<ulist>
								<item>
									<p>
										<kw>[attribute type]</kw> property</p>
								</item>
								<item>
									<p>
										<kw>[normalized value]</kw> property</p>
								</item>
							</ulist>
						</item>
					</ulist>
				</item>
				<item>
					<p>From the XML Schema post-schema validation information set (PSVI)
<bibref ref="xsd"/>, the following properties of <xtermref href="&infoset;/#infoitem.attribute">attribute information items</xtermref> and <xtermref href="&infoset;/#infoitem.element">element information items</xtermref>:</p>
					<ulist>
						<item>
							<p>
								<kw>[schema normalized value]</kw> property</p>
						</item>
						<item>
							<p>Either:</p>
							<ulist>
								<item>
									<p>
										<kw>[member type definition]</kw> property</p>
								</item>
								<item>
									<p>
										<kw>[type definition]</kw> property</p>
								</item>
        <item>
         <p>and the <kw>[name]</kw>, <kw>[target
namespace]</kw> and <kw>[base type definition]</kw> properties of the value thereof</p>
        </item>
							</ulist>
							<p>or:</p>
							<ulist>
								<item>
									<p>
										<kw>[member type definition namespace]</kw> property</p>
								</item>
								<item>
									<p>
										<kw>[member type definition name]</kw> property</p>
								</item>
								<item>
									<p>
										<kw>[type definition namespace]</kw> property</p>
								</item>
								<item>
									<p>
										<kw>[type definition name]</kw> property</p>
								</item>
							</ulist>
						</item>
					</ulist>
				</item>
			</ulist>
			<p>Software components claiming to be XPointer processors <termref def="dt-must">must</termref> conform to this &framework; specification and any other specifications that, together with this specification, define the minimum conformance level for XPointer, and <termref def="dt-must">may</termref> conform to additional XPointer scheme specifications. XPointer processors <termref def="dt-must">must</termref> document the additional scheme specifications to which they conform. Specifications that depend on XPointer processing <termref def="dt-must">should</termref> document the schemes they require and support.</p>
			<p>Conforming XPointer processors <termref def="dt-must">must</termref> report &framework; errors to the application. Applications are free to terminate or recover from &framework; errors in any fashion.</p>
		</div1>
		<div1 id="language">
			<head>Language and Processing</head>
			<p>This section describes the &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>
			<div2 id="syntax">
				<head>Syntax</head>
				<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 <xnt href="&XML;#NT-S">S</xnt> is defined in <bibref ref="XML"/>. The symbols <xnt href="&XMLNames;#NT-NCName">NCName</xnt> and <xnt href="&XMLNames;#NT-QName">QName</xnt> are defined in <bibref ref="XML-Names"/>.</p>
				<scrap>
					<head>&framework; Syntax</head>
					<prodgroup pcw2="6" pcw4="15" pcw5="11.5">
						<prod id="NT-Pointer">
							<lhs>Pointer</lhs>
							<rhs>
								<nt def="NT-Shorthand">Shorthand</nt> | <nt def="NT-SchemeBased">SchemeBased</nt>
							</rhs>
						</prod>
						<prod id="NT-Shorthand">
							<lhs>Shorthand</lhs>
							<rhs>
								<xnt href="&XMLNames;#NT-NCName">NCName</xnt>
							</rhs>
						</prod>
						<prod id="NT-SchemeBased">
							<lhs>SchemeBased</lhs>
							<rhs>
								<nt def="NT-PointerPart">PointerPart</nt> (<xnt href="&XML;#NT-S">S</xnt>? <nt def="NT-PointerPart">PointerPart</nt>)*</rhs>
						</prod>
						<prod id="NT-PointerPart">
							<lhs>PointerPart</lhs>
							<rhs>
								<nt def="NT-SchemeName">SchemeName</nt> '(' <nt def="NT-SchemeData">SchemeData</nt> ')'</rhs>
						</prod>
						<prod id="NT-SchemeName">
							<lhs>SchemeName</lhs>
							<rhs>
								<xnt href="&XMLNames;#NT-QName">QName</xnt>
							</rhs>
						</prod>
						<prod id="NT-SchemeData">
							<lhs>SchemeData</lhs>
							<rhs>
								<nt def="NT-EscapedData">EscapedData</nt>*
							</rhs>
						</prod>
						<prod id="NT-EscapedData">
							<lhs>EscapedData</lhs>
							<rhs>
								<nt def="NT-NormalChar">NormalChar</nt> | '^(' | '^)' | '^^' | '(' <nt def="NT-SchemeData">SchemeData</nt> ')'
							</rhs>
						</prod>
						<prod id="NT-NormalChar">
							<lhs>NormalChar</lhs>
							<rhs>
								<xnt href="#NT-UnicodeChar">UnicodeChar</xnt> - [()^]
							</rhs>
						</prod>
						<prod id="NT-UnicodeChar">
							<lhs>UnicodeChar</lhs>
							<rhs>
								[#x0-#x10FFFF]
							</rhs>
						</prod>
					</prodgroup>
				</scrap>
				<p>As shown in the above productions, the end of a pointer part is signaled by the right parenthesis <quote><code>)</code></quote> character that balances the left parenthesis <quote><code>(</code></quote> character that began the part. If either a left or a right parenthesis occurs in scheme data without being balanced by its counterpart, it <termref def="dt-must">must</termref> be escaped with a circumflex (<code>^</code>) character preceding it. Escaping pairs of balanced parentheses is allowed. Any literal occurrences of the circumflex <termref def="dt-must">must</termref> be escaped with an additional circumflex (that is, <code>^^</code>). Any other use of a circumflex is an error.</p>
			</div2>
			<div2 id="shorthand">
				<head>Shorthand Pointer</head>
				<p>A shorthand pointer, formerly known as a barename, consists of an <xnt href="&XMLNames;#NT-NCName">NCName</xnt> 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 <xnt href="&XMLNames;#NT-NCName">NCName</xnt> as an identifier.  The identifiers of an element are determined as follows:</p>
				<olist>
					<item>
						<p>If an element information item has an attribute information item
among its <kw>[attributes]</kw> that is a <termref def="term-sdi">schema-determined ID</termref>,
then it is identified by the value of that attribute information item's <kw>[schema normalized
value]</kw> property;</p>
					</item>
					<item>
						<p>If an element information item has an element information item
among its <kw>[children]</kw> that is a <termref def="term-sdi">schema-determined ID</termref>,
then it is identified by the value of that element information item's <kw>[schema normalized
value]</kw> property;</p>
					</item>
					<item>
						<p>If an element information item has an attribute information item
among its <kw>[attributes]</kw> that is a <termref def="term-ddi">DTD-determined ID</termref>,
then it is identified by the value of that attribute information item's <kw>[normalized
value]</kw> property.</p>
					</item>
					<item>
						<p>An element information item may also be identified by an <termref def="term-xdi">externally-determined ID</termref> value.</p>
					</item>
				</olist>
				<p>If no element information item is identified by a shorthand pointer's <xnt href="&XMLNames;#NT-NCName">NCName</xnt>, the pointer is in error.</p>
				<note>
					<p>An element information item might be identified by multiple values, in a document with more than one of <termref def="term-ddi">DTD-determined IDs</termref>, <termref def="term-sdi">schema-determined IDs</termref>, and <termref def="term-xdi">externally-determined IDs</termref>.  In such documents, a loss of interoperability might result if the identifier values for a particular element are not always the same.</p>
				</note>
				<p>
					<termdef id="term-sdi" term="schema-determined ID">An element or
attribute information item is a <term>schema-determined ID</term> if and only
if one of the following is true:</termdef></p>
				<olist>
					<item>
						<p>It has a <kw>[member type definition]</kw> or <kw>[type
definition]</kw> property whose value in turn 
has <kw>[name]</kw> equal to <code>ID</code> and <kw>[target namespace]</kw> equal to <code>http://www.w3.org/2001/XMLSchema</code>;</p>
					</item>
					<item>
						<p>It
has a <kw>[base type definition]</kw> whose value has that <kw>[name]</kw> and <kw>[target namespace]</kw>;</p>
					</item>
					<item>
						<p>It has a
<kw>[base type definition]</kw> whose value has a <kw>[base type
definition]</kw> whose value has that <kw>[name]</kw> and
<kw>[target namespace]</kw>, and so on following the <kw>[base type
definition]</kw> property recursively;</p>
					</item>
					<item>
						<p>It has a <kw>[type
definition name]</kw> equal to <code>ID</code>
and a <kw>[type definition namespace]</kw> equal to
<code>http://www.w3.org/2001/XMLSchema</code>;</p>
					</item>
					<item>
						<p>It has a <kw>[member type definition name]</kw> equal to <code>ID</code>
and a <kw>[member type definition namespace]</kw> equal to <code>http://www.w3.org/2001/XMLSchema</code>.</p>
					</item>
				</olist>
				<p><termdef id="term-ddi" term="DTD-determined ID">An
attribute information item is a <term>DTD-determined ID</term> if and only
if it has a <kw>[type definition]</kw> property whose value is equal to <code>ID</code>.</termdef>
				</p>
				<p><termdef id="term-xdi" term="externally-determined ID">An <term>externally-determined ID</term> is a string, representing an element identifier, whose value is determined by the application through mechanisms outside the scope of this specification.</termdef></p>
				<note>
					<p>A shorthand pointer provides, for resources with XML-based media types,
a rough analog of HTML fragment identifier behavior. However, if <kw>ID</kw> 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>
				</note>
				<note>
					<p>The above definitions are <emph>not</emph> affected by whether or not the value which identified an element information item is unique within the document, because neither <bibref ref="XML"/> or <bibref ref="xsd"/> require this for the assignment of type ID.</p>
				</note>
			</div2>
			<div2 id="scheme">
				<head>Scheme-Based Pointer</head>
				<p>A scheme-based pointer consists of one or more pointer parts, optionally separated by white space (<xnt href="&XML;#NT-S">S</xnt>). Each part has a scheme name and contains, within parentheses, data (<xnt href="#NT-EscapedData">EscapedData</xnt>) conforming to the named scheme. If the scheme data contains parentheses, they <termref def="dt-must">must</termref> be either balanced or escaped.</p>
				<p>When multiple pointer parts are provided, an XPointer processor <termref def="dt-must">must</termref> 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>
				<eg><![CDATA[#xpointer(id('boy-blue')/horn[1])element(boy-blue/3)]]></eg>
				<p>A scheme name consists syntactically of an optional <xnt href="&XMLNames;#NT-Prefix">Prefix</xnt> and a <xnt href="&XMLNames;#NT-LocalPart">LocalPart</xnt>, as defined in <bibref ref="XML-Names"/>.  Abstractly, scheme names are a tuple consisting of the <xnt href="&XMLNames;#NT-LocalPart">LocalPart</xnt> and the <xnt href="&XMLNames;#dt-NSName">namespace name</xnt> corresponding to that <xnt href="&XMLNames;#NT-Prefix">Prefix</xnt> in the <termref def="dt-nsbinding">namespace binding context</termref>.  If the namespace binding context contains no corresponding prefix, or if the (<xnt href="&XMLNames;#dt-NSName">namespace name</xnt>, <xnt href="&XMLNames;#NT-LocalPart">LocalPart</xnt>) 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 <xnt href="&XMLNames;#NT-QName">QNames</xnt> 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 <termref def="dt-must">must</termref> specify a name for the scheme, consisting of a (<xnt href="&XMLNames;#dt-NSName">namespace name</xnt>, <xnt href="&XMLNames;#NT-LocalPart">LocalPart</xnt>) pair.</p>
			</div2>
			<div2 id="nsContext">
				<head>Namespace Binding Context</head>
				<p>Scheme specifications <termref def="dt-must">may</termref> define ways to bind XML namespaces <bibref ref="XML-Names"/> prefixes to namespace names for the purpose of interpreting the prefixes of scheme names, or element names, attribute names and other <xnt href="&XMLNames;#NT-QName">QNames</xnt> 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 <termref def="dt-must">must</termref> specify whether its bindings remain in effect for later pointer parts. The documentation for every scheme <termref def="dt-must">must</termref> specify whether it uses the namespace binding context.</p>
				<p>In the following example, the 'xmlns' scheme (see <bibref ref="xptr-xmlns"/>) 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>
				<eg><![CDATA[#xmlns(img=http://example.org/image)img:rect(10,10,50,50)]]></eg>
				<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>
				<ulist>
					<item>
						<p>The <code>xml</code> prefix is bound to the namespace name <code>http://www.w3.org/XML/1998/namespace</code>.  It <termref def="dt-must">must not</termref> be bound to any other namespace name.</p>
					</item>
					<item>
						<p>The namespace name <code>http://www.w3.org/XML/1998/namespace</code> is bound to the prefix <code>xml</code>.  It <termref def="dt-must">must not</termref> be bound to any other prefix.</p>
					</item>
					<item>
						<p>The <code>xmlns</code> prefix <termref def="dt-must">must not</termref> be bound to a namespace name.</p>
					</item>
					<item>
						<p>The namespace name <code>http://www.w3.org/2000/xmlns/</code>	<termref def="dt-must">must not</termref> be bound to any prefix.</p>
					</item>
				</ulist>
				<p>Prefixes beginning with the three-letter sequence x, m, l, in any case combination, are reserved. Users <termref def="dt-must">should not</termref> use them except as defined by XML and XML-related specifications.</p>
			</div2>
		</div1>
		<div1 id="escaping">
			<head>Character Escaping</head>
			<p>The set of characters for XPointers is <bibref ref="unicode"/>.  However, the XPointer language is designed to be used in the context of URI references <bibref ref="rfc2396"/> and IRI references <bibref ref="iri"/>, 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>
			<div2 id="escapingModel">
				<head>Escaping Contexts</head>
				<p>The following contexts require various types of escaping to be applied to XPointers:</p>
				<glist>
					<gitem>
						<label>A. Escaping of XPointer-significant characters</label>
						<def>
							<p>As described in <specref ref="syntax"/>, unbalanced parentheses and occurrences of the circumflex <termref def="dt-must">must</termref> be escaped.</p>
						</def>
					</gitem>
					<gitem>
						<label>B. Escaping and Encoding of reserved IRI characters</label>
						<def>
							<p>
								<termdef id="dt-iri" term="Internationalized Resource Identifier">An <term>Internationalized Resource Identifier</term>, or IRI is a protocol element that extends the syntax of URIs to a much wider repertoire of Unicode characters <bibref ref="unicode"/>.</termdef> IRI references allow a superset of the characters of fully escaped URI references, but <termref def="dt-must">must</termref> 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>) <termref def="dt-must">must</termref> be escaped.  Other characters <termref def="dt-must">may</termref> be escaped as well, though it is not recommended.  Characters are escaped as follows:</p>
							<olist>
								<item>
									<p>Each character to be escaped is converted to UTF-8 <bibref ref="rfc2279"/> as one or more bytes.</p>
								</item>
								<item>
									<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>
								</item>
								<item>
									<p>The original character is replaced by the resulting character sequence.</p>
								</item>
							</olist>
							<p>For example <code>%</code> becomes <code>%25</code>.</p>
						</def>
					</gitem>
					<gitem>
						<label>C. Escaping and Encoding of reserved URI characters</label>
						<def>
							<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 <bibref ref="rfc2396"/>, except for the number sign (#) and percent sign (%) and the square bracket characters re-allowed in <bibref ref="rfc2732"/>.  Disallowed characters are escaped as follows:</p>
							<olist>
								<item>
									<p>Each disallowed character is converted to UTF-8 <bibref ref="rfc2279"/> as one or more bytes.</p>
								</item>
								<item>
									<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>
								</item>
								<item>
									<p>The original character is replaced by the resulting character sequence.</p>
								</item>
							</olist>
						</def>
					</gitem>
					<gitem>
						<label>D. XML escaping</label>
						<def>
							<p>If a pointer appears in an XML document or external parsed entity, any characters not expressible in the encoding used <termref def="dt-must">must</termref> be escaped as character references, and any characters that are significant to XML processing at the point where they appear <termref def="dt-must">must</termref> 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>
						</def>
					</gitem>
				</glist>
				<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>
			</div2>
			<div2 id="escExamples">
				<head>Examples of Escaping</head>
				<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 <bibref ref="xptr-xpointer"/>), since it allows string literals in its scheme data.</p>
				<table border="1" frame="border" summary="Escaping examples">
					<thead>
						<tr>
							<th>Context</th>
							<th>Notation</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>Initial Scheme Data</td>
							<td>The <code>xpointer</code> scheme data as it was initially created: <eg>string-range(//P,"my favorite smiley :-)")</eg>
							</td>
						</tr>
						<tr>
							<td>A.&#160;XPointer</td>
							<td>With the unbalanced parenthesis in the scheme data escaped, as required by this specification: <eg>xpointer(string-range(//P,"my favorite smiley :-^)"))</eg>
							</td>
						</tr>
						<tr>
							<td>B.&#160;Pointer in IRI reference</td>
							<td>Same as A (no percent sign found that needs escaping): <eg>#xpointer(string-range(//P,"my favorite smiley :-^)"))</eg>
							</td>
						</tr>
						<tr>
							<td>C.&#160;IRI reference converted to URI reference</td>
							<td>With occurrences of the double quotatation marks (<code>%22</code>), spaces
(<code>%20</code>), and circumflexes (<code>%5E</code>) escaped:<eg>#xpointer(string-range(//P,%22my%20favorite%20smiley%20:-%5E)%22))</eg>
							</td>
						</tr>
						<tr>
							<td>D.&#160;IRI reference in XML document</td>
							<td>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): <eg>#xpointer(string-range(//P,&amp;quot;my favorite smiley :-^)&amp;quot;))</eg>
							</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 <quote>&#xe9;</quote> to appear directly.</p>
				<table border="1" frame="border" summary="Escaping examples">
					<thead>
						<tr>
							<th>Context</th>
							<th>Notation</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>Initial Scheme Data</td>
							<td>The <code>xpointer</code> scheme data as it was initially created:<eg>id('r&#xe9;sum&#xe9;')</eg>
							</td>
						</tr>
						<tr>
							<td>A.&#160;XPointer</td>
							<td>The XPointer (no circumflexes or unbalanced parentheses in scheme data that need escaping):<eg>xpointer(id('r&#xe9;sum&#xe9;'))</eg>
							</td>
						</tr>
						<tr>
							<td>B.&#160;Pointer in IRI reference</td>
							<td>Same as A (no percent sign found that needs escaping):<eg>#xpointer(id('r&#xe9;sum&#xe9;'))</eg>
							</td>
						</tr>
						<tr>
							<td>C.&#160;IRI reference converted to URI reference</td>
							<td>With occurrences of the letter <quote>&#xe9;</quote> (<code>%C3%A9</code>) escaped:<eg>#xpointer(id('r%C3%A9sum%C3%A9'))</eg>
							</td>
						</tr>
						<tr>
							<td>D.&#160;IRI reference in XML document</td>
							<td>Represented in the <code>US-ASCII</code> encoding; accented letters are escaped with XML character references:<eg>#xpointer(id('r&amp;#xE9;sum&amp;#xE9;'))</eg>
							</td>
						</tr>
					</tbody>
				</table>
			</div2>
		</div1>
	</body>
	<back>
		<div1 id="references">
			<head>References</head>
			<div2 id="normRefs">
				<head>Normative References</head>
				<blist>
					<bibl id="Infoset" key="Infoset">
						John Cowan and Richard Tobin, editors.
						<titleref href="http://www.w3.org/TR/xml-infoset/">XML Information Set</titleref>.
						World Wide Web Consortium, 2001.
					</bibl>
					<bibl id="rfc2119" key="RFC 2119">
						Scott Bradner, 
						<titleref href="http://www.rfc-editor.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="rfc2396" key="RFC 2396">
						Tim Berners-Lee, Roy Fielding, and Larry Masinter,
						<titleref href="http://www.rfc-editor.org/rfc/rfc2396.txt">RFC 2396: Uniform Resource Identifiers</titleref>.
						Internet Engineering Task Force, 1995.
					</bibl>
					<bibl id="rfc2732" key="RFC 2732">
						Robert Hinden, Brian Carpenter, and Larry Masinter,
						<titleref href="http://www.rfc-editor.org/rfc/rfc2732.txt">RFC 2732: Format for Literal IPv6 Addresses in URL's</titleref>.
						Internet Engineering Task Force, 1999.
					</bibl>
					<bibl id="rfc2279" key="RFC 2279">
						François Yergeau
						<titleref href="http://www.rfc-editor.org/rfc/rfc2279.txt">RFC 2279: UTF-8, a transformation format of ISO 10646</titleref>.
						Internet Engineering Task Force, 1998.
					</bibl>
					<bibl id="draft-xmlmediatypes" key="RFC 3023">
						MURATA Makoto, Simon St.Laurent, and Dan Kohn,
						<titleref href="http://www.rfc-editor.org/rfc/rfc3023.txt">RFC 3023: XML Media Types</titleref>.
						Internet Engineering Task Force, 2001.
					</bibl>
					<bibl id="XML" key="XML">
						Tim Bray, Jean Paoli, C.M. Sperberg-McQueen, and Eve Maler, editors.
						<titleref href="&XML;">Extensible Markup Language (XML) 1.0 (Second Edition).</titleref> 
						World Wide Web Consortium, 2000.
					</bibl>
					<bibl id="XML-Names" key="XML-Names">
						Tim Bray, Dave Hollander, and Andrew Layman, editors.  
						<titleref href="&XMLNames;">Namespaces in XML</titleref>. 
						World Wide Web Consortium, 1999.
					</bibl>
					<bibl id="xsd" key="XMLSchema">
						Henry Thompson et al., editors. 
						<titleref href="http://www.w3.org/TR/xmlschema-1/">XML Schema Part 1.</titleref> 
						World Wide Web Consortium, 2001.
					</bibl>
					<bibl id="unicode" key="Unicode">
						The Unicode Consortium
						<titleref href="http://www.unicode.org/unicode/standard/standard.html">The Unicode Standard</titleref>.
					</bibl>
				</blist>
			</div2>
			<div2 id="nonnormRef">
				<head>Non-Normative References</head>
				<blist>
					<bibl id="html" key="HTML">
						Dave Raggett, Arnaud Le Hors, and Ian Jacobs.
						<titleref href="http://www.w3.org/TR/html4/">HTML 4.01 Specification</titleref>. 
						World Wide Web Consortium, 1999.</bibl>
					<bibl id="iri" key="IRI">
						Martin J. D&#252;rst and Michel Suignard
						<titleref href="http://www.w3.org/International/2002/draft-duerst-iri-01.txt">Internationalized Resource Identifiers (IRI)</titleref>
						Internet draft draft-duerst-iri-01, Internet Engineering Task Force, 2002. <emph>Work in progress.</emph>
					</bibl>
					<bibl id="rdf" key="RDF">
						Dave Beckett, editor. 
						<titleref href="http://www.w3.org/TR/REC-rdf-syntax/">RDF/XML Syntax Specification</titleref>. 
						World Wide Web Consortium, 2001.
					</bibl>
					<bibl id="soap12" key="SOAP12">
						Nilo Mitra et al., editors.
						<titleref href="http://www.w3.org/TR/soap12-part0/">SOAP Version 1.2</titleref> 
						Parts 0, 1, and 2. World Wide Web Consortium, 2001. <emph>Work in progress.</emph>
					</bibl>
					<bibl id="xinclude" key="XInclude">
						Jonathan Marsh and David Orchard, editors. 
						<titleref href="http://www.w3.org/TR/xinclude/">XML Inclusions (XInclude) Version 1.0</titleref>. 
						<emph>Work in progress.</emph> World Wide Web Consortium, 2001.
					</bibl>
					<bibl id="XLink" key="XLink">
						Steve DeRose, Eve Maler, and David Orchard, editors. 
						<titleref href="http://www.w3.org/TR/xlink/">XML Linking Language (XLink)</titleref>. 
						World Wide Web Consortium, 2001.
					</bibl>
					<bibl id="xptr-xmlns" key="XPtrXmlns">
						Paul Grosso, Eve Maler, Jonathan Marsh, and Norman Walsh, editors. 
						<titleref href="http://www.w3.org/TR/xptr-xmlns/">XPointer xmlns() Scheme</titleref>. 
						World Wide Web Consortium, 2002.  <emph>Work in progress.</emph>
					</bibl>
					<bibl id="xptr-xpointer" key="XPtrXPointer">
						Steven DeRose, Eve Maler, and Ron Daniel Jr., editors. 
						<titleref href="http://www.w3.org/TR/xptr-xpointer/">XPointer xpointer() Scheme</titleref>. 
						World Wide Web Consortium, 2002.  <emph>Work in progress.</emph>
					</bibl>
				</blist>
			</div2>
		</div1>
	</back>
</spec>
