Network Working Group                                      S. St.Laurent
Internet-Draft                                     O'Reilly & Associates
Expires: April 28, 2003                                 October 28, 2002


                      The XPointer xpath1() Scheme
                   draft-stlaurent-xpath-frag-01.txt

Status of this Memo

   This document is an Internet-Draft and is in full conformance with
   all provisions of Section 10 of RFC2026.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as Internet-
   Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at http://
   www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on April 28, 2003.

Copyright Notice

   Copyright (C) The Internet Society (2002).  All Rights Reserved.

Abstract

   This document specifies an xpath1() scheme for use in XPointer-based
   fragment identifiers.  This scheme, like other XPointer Framework
   [12] schemes, is designed primarily for use with the XML Media Types
   defined in RFC 3023 [5], to identify locations within a given XML
   representation of a resource.  The xpath1() scheme uses XPath 1.0
   syntax









St.Laurent               Expires April 28, 2003                 [Page 1]

Internet-Draft              xpath1() scheme                 October 2002


Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.  Justification  . . . . . . . . . . . . . . . . . . . . . . . .  4
   3.  Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . .  5
   4.  Processing . . . . . . . . . . . . . . . . . . . . . . . . . .  6
   5.  Relation to MIME Media Types . . . . . . . . . . . . . . . . .  7
   6.  XPath Versions . . . . . . . . . . . . . . . . . . . . . . . .  8
   7.  Considerations for Streaming Processing  . . . . . . . . . . .  9
   8.  Conformance  . . . . . . . . . . . . . . . . . . . . . . . . . 10
   9.  Security Considerations  . . . . . . . . . . . . . . . . . . . 11
   10. IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 12
       References . . . . . . . . . . . . . . . . . . . . . . . . . . 13
       Author's Address . . . . . . . . . . . . . . . . . . . . . . . 14
   A.  Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 15
   B.  Revision History . . . . . . . . . . . . . . . . . . . . . . . 16
       Full Copyright Statement . . . . . . . . . . . . . . . . . . . 17


































St.Laurent               Expires April 28, 2003                 [Page 2]

Internet-Draft              xpath1() scheme                 October 2002


1. Introduction

   The XPath 1.0-based xpath1() scheme is intended to be used within the
   XPointer Framework [12] to support the addressing of nodes within XML
   documents.  Like the xpointer() scheme, the xpath1() scheme supports
   addressing into the internal structures of XML documents and external
   parsed entities, supporting addressing document's hierarchical
   structure and choice of its internal parts based on various
   properties, such as element types, attribute values, character
   content, and relative position.  Unlike the xpointer() scheme [15],
   the xpath1() scheme only identifies complete nodes and has no support
   for character-based ranges.







































St.Laurent               Expires April 28, 2003                 [Page 3]

Internet-Draft              xpath1() scheme                 October 2002


2. Justification

   As the W3C's xpointer() scheme [15] already provides a superset of
   the functionality provided by the xpath1() scheme, some consideration
   of why the xpath1() scheme is useful seems worthwhile.

   The xpointer() scheme, designed to support the out-of-line linking
   capabilities of XLink [11], provides support for character ranges
   which may arbitrarily cross node boundaries.  While this is extremely
   useful for many hypertext applications, it is unnecessary for a wide
   variety of simpler projects, and XPath 1.0 is generally far more
   widely supported than the xpointer() scheme.

   While the XPointer Framework explicitly supports multiple levels of
   conformance, the xpointer() scheme states that "Conforming XPointer
   processors claiming to support the xpointer() scheme must conform to
   the behavior defined in this specification and may conform to
   additional XPointer scheme specifications."  Conforming xpointer()
   processors must implement both XPath and the xpointer() scheme's own
   extensions, and while applications might use only the subset of
   xpointer() that is pure XPath, processors built for that approach are
   non-conformant.

   The XPointer set of specifications also includes shorthand pointers
   (based on ID values with their own complications) and support for an
   element() [14] scheme that is effectively a subset of XPath, but
   these offer considerably less functionality than XPath.

   The xpath1() scheme strikes a balance between the simple
   implementation but limited functionality of shorthand pointers and
   the element() scheme, and the complex implementation but great
   capabilities of the xpointer() scheme.  Perhaps more importantly, it
   strikes that balance using processing capabilities that are already
   widely deployed.

















St.Laurent               Expires April 28, 2003                 [Page 4]

Internet-Draft              xpath1() scheme                 October 2002


3. Syntax

   The scheme name is "xpath1".  The scheme data syntax is as follows;
   if scheme data in a pointer part with the xpath1() scheme does not
   conform to the syntax defined in this section, it is an error and the
   pointer part fails.

   xpath1() Scheme Syntax:

     ptrpart             ::=    xpath1( xpath1schemedata )
     xpath1schemedata    ::=    Expr

   Expr is as defined in the XPath 1.0 Recommendation [7].  To support
   identifiers operating on external parsed entities with multiple root
   elements or text nodes, the xpath1() scheme extends the XPath data
   model to permit the root node to contain any sequence of nodes that
   an element node may contain.  (XSLT provides the same extension.)
   Variable references, and function calls other than the core functions
   defined in XPath 1.0, are not allowed.
































St.Laurent               Expires April 28, 2003                 [Page 5]

Internet-Draft              xpath1() scheme                 October 2002


4. Processing

   The XML namespace [10] context for the XPath should be set by
   previous XPointer parts using the XPointer xmlns() scheme [13].  The
   XPath expression is evaluated with a context position and size of 1,
   and a context node that is the element containing the XPointer.

   Evaluating the expression contained in xpath1schemedata in that
   namespace and document context returns a location-set or an error.
   If the XPath expression identifies a single node, then the location-
   set contains a single location corresponding to that node.  If the
   XPath expression identifies a node-set, this XPointer identifies a
   location-set corresponding to the node-set.  If the result of the
   XPath expression is something other than a node or node-set, the
   XPointer result is an error.

   XPath resolution may return varying results depending on the parser
   used to feed the XPath processor.  As non-validating parsers are not
   required to retrieve and incorporate external parsed entities, it is
   possible that the document in this situation will be incomplete.
   Variable interpretations of XInclude [9] processing may also cause
   difficulties, though that may be addressed using the xinclude1() [16]
   scheme.




























St.Laurent               Expires April 28, 2003                 [Page 6]

Internet-Draft              xpath1() scheme                 October 2002


5. Relation to MIME Media Types

   MIME Media type registrations should indicate whether or not the
   xpath1() scheme is applicable to their contents.  While this scheme
   is obviously most directly connected to XML registrations made in
   accordance with RFC 3023 [5], it could conceivably be used with any
   registration made in accordance with RFC 2046 [1] and RFC 2048 [2],
   provided that the registration provides an explicit mapping between
   an XML structure and the contents of the type.










































St.Laurent               Expires April 28, 2003                 [Page 7]

Internet-Draft              xpath1() scheme                 October 2002


6. XPath Versions

   At the time of writing, the W3C is developing Version 2.0 of XPath
   [8].  While this version has many more features, it also has many
   more dependencies and will require a much more sophisticated
   processor.  Developers who want to use XPath 2.0 for fragment
   identifiers should define a new XPointer scheme (perhaps xpath2()).
   All xpath1() scheme processors must reject expressions which do not
   conform to the syntax and feature set of XPath 1.0 [7].










































St.Laurent               Expires April 28, 2003                 [Page 8]

Internet-Draft              xpath1() scheme                 October 2002


7. Considerations for Streaming Processing

   Current versions of XPath provide support for navigation from the
   later points in a document to prior points, a useful set of tools but
   only in contexts where the complete document (or substantial portions
   of it) remain available throughout expression processing.  The
   xpath1() scheme supports that functionality and therefore makes a
   purely streaming processor difficult to write.  Developers who need
   to be able to support streaming processing of fragment identifiers
   should consider or create other schemes.









































St.Laurent               Expires April 28, 2003                 [Page 9]

Internet-Draft              xpath1() scheme                 October 2002


8. Conformance

   This specification normatively depends on the XPointer Framework
   [12], except insofar as it rejects the claim in Section 3.3 that
   "this specification reserves all scheme names for definition in
   additional W3C XPointer scheme specifications", and also normatively
   depends on XPath 1.0 [7].  It also normatively depends on the
   XPointer xmlns() scheme [13].  XPointer processors claiming to
   conform to this specification must also conform to the xmlns()
   specification.

   The scheme data for the xpath1() scheme conforms to this
   specification if it is processable using XPath 1.0 [7],  with support
   for multi-rooted external parsed entities if applied in that context.

   Conforming XPointer processors claiming to support the xpath1()
   scheme must conform to the behavior defined in this specification and
   may conform to additional XPointer scheme specifications, including
   in particular the xpointer() scheme [15] which is a superset of the
   xpath1() scheme.































St.Laurent               Expires April 28, 2003                [Page 10]

Internet-Draft              xpath1() scheme                 October 2002


9. Security Considerations

   While it is conceivable that faulty XPath expressions could be used
   to overflow or overload XPath processors used in processing of the
   xpath1() scheme data, the author is not aware of any such assaults
   having taken place.  XPath processors should be robust enough to
   handle or reject XPaths of all kinds in order to process this scheme.












































St.Laurent               Expires April 28, 2003                [Page 11]

Internet-Draft              xpath1() scheme                 October 2002


10. IANA Considerations

   None.
















































St.Laurent               Expires April 28, 2003                [Page 12]

Internet-Draft              xpath1() scheme                 October 2002


References

   [1]   Freed, N. and N. Borenstein, "Multipurpose Internet Mail
         Extensions (MIME) Part Two: Media Types", RFC 2046, November
         1996.

   [2]   Freed, N., Klensin, J. and J. Postel, "Multipurpose Internet
         Mail Extensions (MIME) Part Four: Registration Procedures", RFC
         2048, November 1996.

   [3]   Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform
         Resource Identifiers (URI): Generic Syntax", RFC 2396, August
         1998.

   [4]   Rose, M., "Writing I-Ds and RFCs using XML", RFC 2629, June
         1999.

   [5]   Murata, M., St.Laurent, S. and D. Kohn, "XML Media Types", RFC
         3023, January 2001.

   [6]   Bray, T., Paoli, J. and C. Sperberg-McQueen, "Extensible Markup
         Language (XML) 1.0", World Wide Web Consortium Recommendation
         REC-xml, February 1998, <http://www.w3.org/TR/REC-xml>.

   [7]   DeRose, S. and J. Clark, "XML Path Language (XPath) Version
         1.0", World Wide Web Consortium Recommendation REC-xpath-
         19991116, November 1999, <http://www.w3.org/TR/1999/REC-xpath-
         19991116>.

   [8]   Berglund, A., Boag, S., Chamberlin, D., Fernandez, M., Kay, M.,
         Robie, J. and J. Simeon, "XML Path Language (XPath) 2.0", World
         Wide Web Consortium Working Draft WD-xpath20-20020816, November
         1999, <http://www.w3.org/TR/xpath20/>.

   [9]   Marsh, J. and D. Orchard, "XML Inclusions (XInclude) Version
         1.0", World Wide Web Consortium Candidate Recommendation CR-
         xinclude-20020221/, September 2002, <http://www.w3.org/TR/
         xinclude/>.

   [10]  Bray, T., Hollander, D. and A. Layman, "Namespaces in XML",
         World Wide Web Consortium Recommendation REC-xml-names, January
         1999, <http://www.w3.org/TR/REC-xml-names/>.

   [11]  DeRose, S., Maler, E. and D. Orchard, "XML Linking Language
         (XLink)", World Wide Web Consortium Recommendation XLink, June
         2001, <http://www.w3.org/TR/xlink/>.

   [12]  Grosso, P., Maler, E., Marsh, J. and N. Walsh, "XPointer



St.Laurent               Expires April 28, 2003                [Page 13]

Internet-Draft              xpath1() scheme                 October 2002


         Framework", World Wide Web Consortium Working Draft XPointer
         Framework, July 2002, <http://www.w3.org/TR/xptr-framework/>.

   [13]  DeRose, S., Daniel Jr., R. and E. Maler, "XPointer xmlns()
         Scheme", World Wide Web Consortium Working Draft XPointer
         xmlns() Scheme, July 2002, <http://www.w3.org/TR/xptr-xmlns/>.

   [14]  Grosso, P., Maler, E., Marsh, J. and N. Walsh, "XPointer
         element() Scheme", World Wide Web Consortium Working Draft
         XPointer element() Scheme, July 2002, <http://www.w3.org/TR/
         xptr-element/>.

   [15]  DeRose, S., Daniel Jr., R. and E. Maler, "XPointer xpointer()
         Scheme", World Wide Web Consortium Working Draft XPointer
         xpointer() Scheme, July 2002, <http://www.w3.org/TR/xptr-
         xpointer/>.

   [16]  St.Laurent, S., "The XPointer xinclude1() Scheme", I-D draft-
         stlaurent-xinclude-frag-00.txt, October 2002, <http://
         www.ietf.org/internet-drafts/draft-stlaurent-xinclude-frag-
         00.txt>.


Author's Address

   Simon St.Laurent
   O'Reilly & Associates
   1259 Dryden Road
   Ithaca, New York  14850
   USA

   EMail: simonstl@simonstl.com
   URI:   http://www.simonstl.com/


















St.Laurent               Expires April 28, 2003                [Page 14]

Internet-Draft              xpath1() scheme                 October 2002


Appendix A. Acknowledgements

   Thanks to Uche Ogbuji and Eric van der Vlist for inspiration.
   Michael Kay provided much guidance on defining the XPath processing
   context, and discussion on xml-dev has made some complications
   (especially around XInclude and entity processing) much clearer.













































St.Laurent               Expires April 28, 2003                [Page 15]

Internet-Draft              xpath1() scheme                 October 2002


Appendix B. Revision History

   00 - First version.

   01 - Added Michael Kay's processing context specification.  Added
   language on external parsed entities and XInclude.  Cleaned up typos.

   [To be deleted before publication.]











































St.Laurent               Expires April 28, 2003                [Page 16]

Internet-Draft              xpath1() scheme                 October 2002


Full Copyright Statement

   Copyright (C) The Internet Society (2002).  All Rights Reserved.

   This document and translations of it may be copied and furnished to
   others, and derivative works that comment on or otherwise explain it
   or assist in its implementation may be prepared, copied, published
   and distributed, in whole or in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included on all such copies and derivative works.  However, this
   document itself may not be modified in any way, such as by removing
   the copyright notice or references to the Internet Society or other
   Internet organizations, except as needed for the purpose of
   developing Internet standards in which case the procedures for
   copyrights defined in the Internet Standards process must be
   followed, or as required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will not be
   revoked by the Internet Society or its successors or assigns.

   This document and the information contained herein is provided on an
   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
   BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
   HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Acknowledgement

   Funding for the RFC Editor function is currently provided by the
   Internet Society.



















St.Laurent               Expires April 28, 2003                [Page 17]