One document matched: draft-wilde-xml-patch-02.xml
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<?rfc toc="yes" ?>
<?rfc sortrefs="yes" ?>
<?rfc symrefs="no" ?>
<rfc category="std" ipr="trust200902" docName="draft-wilde-xml-patch-02">
<front>
<title abbrev="XML Patch">A Media Type for XML Patch Operations</title>
<author initials="E." surname="Wilde" fullname="Erik Wilde">
<organization>EMC</organization>
<address>
<email>erik.wilde@emc.com</email>
</address>
</author>
<date day="8" month="February" year="2013"/>
<abstract>
<t>The XML Patch media type "application/xml-patch+xml" defines an XML document structure for expressing a sequence of patch operations that are applied to an XML document. The XML Patch document format's foundations are defined in RFC 5261, this specification defines a document format and a media type registration, so that XML Patch documents can be labeled with a media type, for example in HTTP conversations.</t>
</abstract>
<note title="Note to Readers">
<t>This draft should be discussed on the <eref target="https://www.ietf.org/mailman/listinfo/apps-discuss">apps-discuss mailing list</eref>.</t>
<t>Online access to all versions and files is available at <eref target="https://github.com/dret/I-D/tree/master/xml-patch">github</eref>.</t>
</note>
</front>
<middle>
<section title="Introduction">
<t>The Extensible Markup Language (XML) <xref target="RFC3023"/> is a common format for the exchange and storage of structured data. HTTP PATCH <xref target="RFC5789"/> extends HTTP <xref target="RFC2616"/> with a method to perform partial modifications to resources. HTTP PATCH requires that patch documents are being sent along with the request, and it is therefore useful if there are standardized patch document formats (identified by media types) for popular media types.</t>
<t>The XML Patch media type "application/xml-patch+xml" is an XML document structure for expressing a sequence of operations to apply to a target XML document, suitable for use with the HTTP PATCH method. Servers can freely choose which patch formats they want to accept, and "application/xml-patch+xml" could be a simple default format that can be used unless a server decides to use a different (maybe more sophisticated) patch format for XML.</t>
<t>The format for patch documents is based on the XML Patch Framework defined in RFC 5261 <xref target="RFC5261"/>. While RFC 5261 does define a concrete syntax as well as the media type "application/patch-ops-error+xml" for error documents, it only defines XML Schema (XSD) <xref target="W3C.REC-xmlschema-1-20041028"/> types for patch operations, and thus the concrete document format and the media type for patch operations are defined in an XSD defined in this specification.</t>
</section>
<section title="IANA Considerations" anchor="iana">
<t>The Internet media type <xref target="RFC6838"/> for an XML Patch Document is application/xml-patch+xml.</t>
<t>
<list>
<t>Type name: application</t>
<t>Subtype name: xml-patch+xml</t>
<t>Required parameters: none</t>
<t>Optional parameters: Same as charset parameter for the media type "application/xml" as specified in RFC 3023 <xref target="RFC3023"/>.</t>
<t>Encoding considerations: Same as encoding considerations of media type "application/xml" as specified in RFC 3023 <xref target="RFC3023"/>.</t>
<t>Security considerations: This media type has all of the security considerations described in RFC 3023 <xref target="RFC3023"/> and RFC 5261 <xref target="RFC5261"/>, plus those listed in <xref target="security-considerations"/>.</t>
<t>Interoperability considerations: N/A</t>
<t>Published specification: RFC XXXX</t>
<t>Applications that use this media type: Applications that manipulate XML documents.</t>
<t>Additional information:
<list>
<t>Magic number(s): N/A</t>
<t>File extension(s): XML documents should use ".xml" as the file extension.</t>
<t>Macintosh file type code(s): TEXT</t>
</list>
</t>
<t>Person & email address to contact for further information: Erik Wilde <erik.wilde@emc.com></t>
<t>Intended usage: COMMON</t>
<t>Restrictions on usage: none</t>
<t>Author: Erik Wilde <erik.wilde@emc.com></t>
<t>Change controller: IETF</t>
</list>
</t>
</section>
<section title="Patch Document Format" anchor="schema">
<t>The XML patch document format is based on a simple schema that uses a "patch" element as the document element, and allows an arbitrary sequence of "add", "remove", and "replace" elements as the children of the document element. These children follow the semantics defined in RFC 5261, which means that each element is treated as an individual patch operation, and the result of each patch operation is a patched XML document that is the target XML document for the next patch operation.</t>
<t>The following example patch document uses the example from RFC 5261, and simply uses a "patch" element and a new XML namespace. It shows the general structure of an XML patch document, as well as an example for each operation.</t>
<figure>
<artwork><![CDATA[<p:patch xmlns="urn:ietf:params:xml:ns:xxx" xmlns:y="urn:ietf:params:xml:ns:yyy"
xmlns:p="urn:ietf:rfc:XXXX" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:rfc:XXXX patch-document-00.xsd">
<p:add sel="doc/elem[@a='foo']">
<!-- This is a new child -->
<child id="ert4773">
<y:node/>
</child>
</p:add>
<p:replace sel="doc/note/text()">Patched doc</p:replace>
<p:remove sel="*/elem[@a='bar']/y:child" ws="both"/>
<p:add sel="*/elem[@a='bar']" type="@b">new attr</p:add>
</p:patch>]]></artwork>
</figure>
<t>As this example demonstrates, both the document element "patch" and the patch operation elements are in the same XML namespace. This is the result of RFC 5261 only defining types for the patch operation elements, which then can be reused in schemas to define concrete patch elements.</t>
<t>RFC 5261 defines an XML Schema (XSD) <xref target="W3C.REC-xmlschema-1-20041028"/> for the patch operation types, which is included for reference in <xref target="rfc5261-xsd"/>. The normative version of this schema is the one given in RFC 5261. The following schema for the XML Patch media type is based on the types defined in RFC 5261, which are imported as "rfc5261.xsd" in the following schema. The schema defines a "patch" document element, and then allows an unlimited (and possibly empty) sequence of the "add", "remove", and "replace" operation elements, which are directly based on the respective types from the schema defined in RFC 5261.</t>
<figure>
<artwork><![CDATA[<xs:schema targetNamespace="urn:ietf:rfc:XXXX"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:import schemaLocation="rfc5261.xsd"/>
<xs:element name="patch">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="add" type="add"/>
<xs:element name="remove" type="remove"/>
<xs:element name="replace" type="replace"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>]]></artwork>
</figure>
</section>
<section title="Patch Examples" anchor="examples">
<t>Since the semantics of the XML patch operations are defined by RFC 5261, please refer to the numerous examples in that specification for concrete XML patch document examples. Most importantly, the examples in RFC 5261 can be taken literally as examples for the XML Patch media type, as long as it is assumed that the XML namespace for the operation elements in these examples is the URI "urn:ietf:rfc:XXXX".</t>
</section>
<section title="Security Considerations" anchor="security-considerations">
<t>...</t>
</section>
<section title="Implementation Hints" anchor="implementation-hints">
<t>This section is informative. It described some issues that might be interesting for implementors, but it might also be interesting for users of XML Patch that want to understand some of the differences between standard XPath 1.0 processing, and the processing model of RFC 5261.</t>
<section title="Namespace Matching Rules">
<t>RFC 5261 defines standard rules for matching prefixed names in expressions: Any prefixes are interpreted according to the namespace bindings of the diff document (the document that the expression is applied against). This means that each prefixed name can be interpreted in the context of the diff document.</t>
<t>For unprefixed names in expressions, the rules depart from XPath 1.0 <xref target="W3C.REC-xpath-19991116"/>. XPath 1.0 defines that unprefixed names in expressions match namespace-less names (i.e., there is no "default namespace" for names used in XPath 1.0 expressions). RFC 5261 requires, however, that unprefixed names in expressions must use the default namespace of the diff document (if there is one). This means that it is not possible to simply take a selector from a patch document and evaluate it in the context of the diff document according to the rules of XPath 1.0, because this would interpret unprefixed names incorrectly. As a consequence, it is not possible to simply take an XPath 1.0 processor and evaluate XMPL Patch selectors in the context of the diff document.</t>
<t>As an extension of XPath 1.0's simple model, XPath 2.0 <xref target="W3C.REC-xpath20-20101214"/> specifies different processing rules for unprefixed names: They are matched against the URI of the "default element/type namespace", which is defined as part of an expression's static context. In some XPath 2.0 applications this can be set; XSLT 2.0 for example has the ability to define an "xpath-default-namespace", which then will be used to match unprefixed names in expressions. Thus, by using an XPath 2.0 implementation that allows to set this URI, and setting it to the default namespace of the diff document (or leaving it undefined if there is no such default namespace), it is possible to use an out-of-the-box XPath 2.0 implementation for evaluating XML Patch selectors.</t>
<t>Please keep in mind, however, that evaluating selectors is only one part of applying patches. When it comes to applying the actual patch operations, neither XPath 1.0 nor XPath 2.0 are sufficient, because they are not preserving some of the information from the XML syntax (specifically: namespace declarations) that is required to correctly apply patch operations. The following section described this issue in more detail.</t>
<t>[[[ Currently, RFC 5261's section on namespace matching explains XPath 2.0's rules incorrectly <eref target="http://tools.ietf.org/html/rfc5261#section-4.2.2"/>. An erratum has been filed <eref target="http://www.rfc-editor.org/errata_search.php?rfc=5261&eid=3477"/> which, upon verification, will be linked to from here. ]]]</t>
</section>
<section title="Patching Namespaces">
<t>One of the issues when patching namespaces based on XPath is that XPath exposes namespaces different than the XML 1.0 <xref target="W3C.REC-xml-20081126"/> syntax for XML Namespaces <xref target="W3C.REC-xml-names-20091208"/>. In the XML syntax, a namespace is declared with an attribute using the reserved name or prefix "xmlns", and this results in this namespace being available recursively through the document tree. In XPath, the namespace declaration is not exposed as an attribute (i.e., the attribute, although syntactically an XML attribute, is not accessible in XPath), but the namespace nodes are exposed recursively through the tree.</t>
<t>RFC 5261 uses the terms "namespace declaration" and "namespace" almost interchangeably, but it is important to keep in mind that the namespace declaration is an XML syntax construct that is unavailable in XPath, while the namespace itself is a logical construct that is not visible in the XML syntax, but a result of a namespace declaration. The intent of RFC 5261 is to patch namespaces as if namespace declarations were patched, and thus it only allows to patch namespace nodes on the element nodes where the namespace has been declared.</t>
<t>Patching namespaces in XML Patch is supposed to "emulate" the effect of actually changing the namespace declaration (which is why a namespace can only be patched at the element where it has been declared). Therefore, when patching a namespace, even though XPath's "namespace" axis is used, implementations have to make sure that not only the one selected namespace node is being patched, but that all namespaces nodes resulting from the namespace declaration of this namespace are patched accordingly.</t>
<t>This means that an implementation might have to descend into the tree, matching all namespace nodes with the selected prefix/URI pair recursively, until it encounters namespace declarations with the same prefix it is patching. Determining this requires access to the diff document beyond XPath, because in XPath itself namespace declarations are not represented, and thus such a recursive algorithm wouldn't know when to stop. Consider the following document:</t>
<figure>
<artwork><![CDATA[<x xmlns:a="tag:42">
<y xmlns:a="tag:42"/>
</x>]]></artwork>
</figure>
<t>If this document is patched with a selector of /x/namespace::a, then only the namespace node on element x should be patched, even though the namespace node on element y has the same prefix/URI combination than the one on element x. Determining that the repeated namespace declaration was present at all on element y is impossible when using XPath alone, so implementations must have an alternative way to determine the difference between the document above, and this one:</t>
<figure>
<artwork><![CDATA[<x xmlns:a="tag:42">
<y/>
</x>]]></artwork>
</figure>
<t>In this second example, patching with a selector of /x/namespace::a should indeed change the namespace nodes on elements x and y, because they both have been derived from the same namespace declaration.</t>
<t>The conclusion of these considerations is that for implementing XML Patch, access to the XML syntax (specifically: namespace declarations) is necessary. As a result, implementations attempting to exclusively use the XPath model for implementing XML Patch will fail to correctly address certain edge cases (as the one shown above).</t>
<t>[[[ Currently, RFC 5261's section on replacing namespaces mixes the terms "namespace declaration" and "namespace" <eref target="http://tools.ietf.org/html/rfc5261#section-4.4.3"/>. An erratum has been filed <eref target="http://www.rfc-editor.org/errata_search.php?eid=3478"/> which, upon verification, will be linked to from here. ]]]</t>
</section>
</section>
<section title="Change Log">
<t>Note to RFC Editor: Please remove this section before publication.</t>
<section title="From -01 to -02">
<t>
<list style="symbols">
<t>Textual edits.</t>
<t>Added section on "Implementation Hints" (<xref target="implementation-hints"/>).</t>
</list>
</t>
</section>
<section title="From -00 to -01">
<t>
<list style="symbols">
<t>Removed Mark Nottingham from author list.</t>
<t>Changed media type name to application/xml-patch+xml (added suffix per draft-ietf-appsawg-media-type-suffix-regs)</t>
<t>Added ABNF grammar derived from XSD (<xref target="rfc5261-abnf"/>)</t>
</list>
</t>
</section>
</section>
</middle>
<back>
<references title="Normative References">
<reference anchor="RFC2045">
<front>
<title abbrev="Internet Message Bodies">Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies</title>
<author initials="N." surname="Freed" fullname="Ned Freed">
<organization>Innosoft International, Inc.</organization>
<address>
<postal>
<street>1050 East Garvey Avenue South</street>
<city>West Covina</city>
<region>CA</region>
<code>91790</code>
<country>US</country>
</postal>
<phone>+1 818 919 3600</phone>
<facsimile>+1 818 919 3614</facsimile>
<email>ned@innosoft.com</email>
</address>
</author>
<author initials="N. S." surname="Borenstein" fullname="Nathaniel S. Borenstein">
<organization>First Virtual Holdings</organization>
<address>
<postal>
<street>25 Washington Avenue</street>
<city>Morristown</city>
<region>NJ</region>
<code>07960</code>
<country>US</country>
</postal>
<phone>+1 201 540 8967</phone>
<facsimile>+1 201 993 3032</facsimile>
<email>nsb@nsb.fv.com</email>
</address>
</author>
<date month="November" year="1996"/>
</front>
<seriesInfo name="RFC" value="2045"/>
</reference>
<reference anchor="RFC2046">
<front>
<title abbrev="Media Types">Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types</title>
<author initials="N." surname="Freed" fullname="Ned Freed">
<organization>Innosoft International, Inc.</organization>
<address>
<postal>
<street>1050 East Garvey Avenue South</street>
<city>West Covina</city>
<region>CA</region>
<code>91790</code>
<country>US</country>
</postal>
<phone>+1 818 919 3600</phone>
<facsimile>+1 818 919 3614</facsimile>
<email>ned@innosoft.com</email>
</address>
</author>
<author initials="N." surname="Borenstein" fullname="Nathaniel S. Borenstein">
<organization>First Virtual Holdings</organization>
<address>
<postal>
<street>25 Washington Avenue</street>
<city>Morristown</city>
<region>NJ</region>
<code>07960</code>
<country>US</country>
</postal>
<phone>+1 201 540 8967</phone>
<facsimile>+1 201 993 3032</facsimile>
<email>nsb@nsb.fv.com</email>
</address>
</author>
<date month="November" year="1996"/>
</front>
<seriesInfo name="RFC" value="2046"/>
</reference>
<reference anchor='RFC3023'>
<front>
<title>XML Media Types</title>
<author initials='M.' surname='Murata' fullname='M. Murata'>
<organization /></author>
<author initials='S.' surname='St. Laurent' fullname='S. St. Laurent'>
<organization /></author>
<author initials='D.' surname='Kohn' fullname='D. Kohn'>
<organization /></author>
<date year='2001' month='January' />
<abstract>
<t>This document standardizes five new media types - text/xml, application/xml, text/xml-external-parsed-entity, application/xml- external-parsed-entity, and application/xml-dtd - for use in exchanging network entities that are related to the Extensible Markup Language (XML). This document also standardizes a convention (using the suffix '+xml') for naming media types outside of these five types when those media types represent XML MIME (Multipurpose Internet Mail Extensions) entities. [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='3023' />
<format type='TXT' octets='86011' target='http://www.rfc-editor.org/rfc/rfc3023.txt' />
</reference>
<reference anchor='RFC6838'>
<front>
<title>Media Type Specifications and Registration Procedures</title>
<author initials='N.' surname='Freed' fullname='N. Freed'>
<organization />
</author>
<author initials='J.' surname='Klensin' fullname='J. Klensin'>
<organization />
</author>
<author initials='T.' surname='Hansen' fullname='T. Hansen'>
<organization />
</author>
<date year='2013' month='January' />
<abstract>
<t>This document defines procedures for the specification and registration of media types for use in HTTP, MIME, and other Internet protocols. This memo documents an Internet Best Current Practice.</t>
</abstract>
</front>
<seriesInfo name='BCP' value='13' />
<seriesInfo name='RFC' value='6838' />
<format type='TXT' octets='72942' target='http://www.rfc-editor.org/rfc/rfc6838.txt' />
</reference>
<reference anchor='RFC5261'>
<front>
<title>An Extensible Markup Language (XML) Patch Operations Framework Utilizing XML Path Language (XPath) Selectors</title>
<author initials='J.' surname='Urpalainen' fullname='J. Urpalainen'>
<organization />
</author>
<date year='2008' month='September' />
<abstract>
<t>Extensible Markup Language (XML) documents are widely used as containers for the exchange and storage of arbitrary data in today's systems. In order to send changes to an XML document, an entire copy of the new version must be sent, unless there is a means of indicating only the portions that have changed. This document describes an XML patch framework utilizing XML Path language (XPath) selectors. These selector values and updated new data content constitute the basis of patch operations described in this document. In addition to them, with basic &lt;add&gt;, &lt;replace&gt;, and &lt;remove&gt; directives a set of patches can then be applied to update an existing XML document. [STANDARDS-TRACK]</t>
</abstract>
</front>
<seriesInfo name='RFC' value='5261' />
<format type='TXT' octets='78036' target='http://www.rfc-editor.org/rfc/rfc5261.txt' />
</reference>
</references>
<references title="Non-Normative References">
<reference anchor='RFC2616'>
<front>
<title abbrev='HTTP/1.1'>Hypertext Transfer Protocol -- HTTP/1.1</title>
<author initials='R.' surname='Fielding' fullname='Roy T. Fielding'>
<organization abbrev='UC Irvine'>Department of Information and Computer Science</organization>
<address>
<postal>
<street>University of California, Irvine</street>
<city>Irvine</city>
<region>CA</region>
<code>92697-3425</code></postal>
<facsimile>+1(949)824-1715</facsimile>
<email>fielding@ics.uci.edu</email>
</address>
</author>
<author initials='J.' surname='Gettys' fullname='James Gettys'>
<organization abbrev='Compaq/W3C'>World Wide Web Consortium</organization>
<address>
<postal>
<street>MIT Laboratory for Computer Science, NE43-356</street>
<street>545 Technology Square</street>
<city>Cambridge</city>
<region>MA</region>
<code>02139</code></postal>
<facsimile>+1(617)258-8682</facsimile>
<email>jg@w3.org</email>
</address>
</author>
<author initials='J.' surname='Mogul' fullname='Jeffrey C. Mogul'>
<organization abbrev='Compaq'>Compaq Computer Corporation</organization>
<address>
<postal>
<street>Western Research Laboratory</street>
<street>250 University Avenue</street>
<city>Palo Alto</city>
<region>CA</region>
<code>94305</code></postal>
<email>mogul@wrl.dec.com</email>
</address>
</author>
<author initials='H.' surname='Frystyk' fullname='Henrik Frystyk Nielsen'>
<organization abbrev='W3C/MIT'>World Wide Web Consortium</organization>
<address>
<postal>
<street>MIT Laboratory for Computer Science, NE43-356</street>
<street>545 Technology Square</street>
<city>Cambridge</city>
<region>MA</region>
<code>02139</code></postal>
<facsimile>+1(617)258-8682</facsimile>
<email>frystyk@w3.org</email>
</address>
</author>
<author initials='L.' surname='Masinter' fullname='Larry Masinter'>
<organization abbrev='Xerox'>Xerox Corporation</organization>
<address>
<postal>
<street>MIT Laboratory for Computer Science, NE43-356</street>
<street>3333 Coyote Hill Road</street>
<city>Palo Alto</city>
<region>CA</region>
<code>94034</code></postal>
<email>masinter@parc.xerox.com</email>
</address>
</author>
<author initials='P.' surname='Leach' fullname='Paul J. Leach'>
<organization abbrev='Microsoft'>Microsoft Corporation</organization>
<address>
<postal>
<street>1 Microsoft Way</street>
<city>Redmond</city>
<region>WA</region>
<code>98052</code></postal>
<email>paulle@microsoft.com</email>
</address>
</author>
<author initials='T.' surname='Berners-Lee' fullname='Tim Berners-Lee'>
<organization abbrev='W3C/MIT'>World Wide Web Consortium</organization>
<address>
<postal>
<street>MIT Laboratory for Computer Science, NE43-356</street>
<street>545 Technology Square</street>
<city>Cambridge</city>
<region>MA</region>
<code>02139</code></postal>
<facsimile>+1(617)258-8682</facsimile>
<email>timbl@w3.org</email>
</address>
</author>
<date year='1999' month='June' />
<abstract>
<t>The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred.</t>
<t>HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as "HTTP/1.1", and is an update to RFC 2068.
</t>
</abstract>
</front>
<seriesInfo name='RFC' value='2616' />
<format type='TXT' octets='422317' target='http://www.rfc-editor.org/rfc/rfc2616.txt' />
<format type='PS' octets='5529857' target='http://www.rfc-editor.org/rfc/rfc2616.ps' />
<format type='PDF' octets='550558' target='http://www.rfc-editor.org/rfc/rfc2616.pdf' />
<format type='HTML' octets='637302' target='http://xml.resource.org/public/rfc/html/rfc2616.html' />
<format type='XML' octets='493420' target='http://xml.resource.org/public/rfc/xml/rfc2616.xml' />
</reference>
<reference anchor='RFC5789'>
<front>
<title>PATCH Method for HTTP</title>
<author initials='L.' surname='Dusseault' fullname='L. Dusseault'>
<organization /></author>
<author initials='J.' surname='Snell' fullname='J. Snell'>
<organization /></author>
<date year='2010' month='March' />
<abstract>
<t>Several applications extending the Hypertext Transfer Protocol (HTTP) require a feature to do partial resource modification. The existing HTTP PUT method only allows a complete replacement of a document. This proposal adds a new HTTP method, PATCH, to modify an existing HTTP resource. [STANDARDS-TRACK]</t>
</abstract>
</front>
<seriesInfo name='RFC' value='5789' />
<format type='TXT' octets='21706' target='http://www.rfc-editor.org/rfc/rfc5789.txt' />
</reference>
<reference anchor='W3C.REC-xml-names-20091208' target='http://www.w3.org/TR/2009/REC-xml-names-20091208'>
<front>
<title>Namespaces in XML 1.0 (Third Edition)</title>
<author initials='D.' surname='Hollander' fullname='Dave Hollander'>
<organization />
</author>
<author initials='A.' surname='Layman' fullname='Andrew Layman'>
<organization />
</author>
<author initials='T.' surname='Bray' fullname='Tim Bray'>
<organization />
</author>
<author initials='R.' surname='Tobin' fullname='Richard Tobin'>
<organization />
</author>
<author initials='H.' surname='Thompson' fullname='Henry S. Thompson'>
<organization />
</author>
<date month='December' day='8' year='2009' />
</front>
<seriesInfo name='World Wide Web Consortium Recommendation' value='REC-xml-names-20091208' />
<format type='HTML' target='http://www.w3.org/TR/2009/REC-xml-names-20091208' />
</reference>
<reference anchor='W3C.REC-xml-20081126' target='http://www.w3.org/TR/2008/REC-xml-20081126'>
<front>
<title>Extensible Markup Language (XML) 1.0 (Fifth Edition)</title>
<author initials='C.' surname='Sperberg-McQueen' fullname='C. M. Sperberg-McQueen'>
<organization />
</author>
<author initials='F.' surname='Yergeau' fullname='Francois Yergeau'>
<organization />
</author>
<author initials='J.' surname='Paoli' fullname='Jean Paoli'>
<organization />
</author>
<author initials='E.' surname='Maler' fullname='Eve Maler'>
<organization />
</author>
<author initials='T.' surname='Bray' fullname='Tim Bray'>
<organization />
</author>
<date month='November' day='26' year='2008' />
</front>
<seriesInfo name='World Wide Web Consortium Recommendation' value='REC-xml-20081126' />
<format type='HTML' target='http://www.w3.org/TR/2008/REC-xml-20081126' />
</reference>
<reference anchor='W3C.REC-xpath-19991116' target='http://www.w3.org/TR/1999/REC-xpath-19991116'>
<front>
<title>XML Path Language (XPath) Version 1.0</title>
<author initials='S.' surname='DeRose' fullname='Steven DeRose'>
<organization />
</author>
<author initials='J.' surname='Clark' fullname='James Clark'>
<organization />
</author>
<date month='November' day='16' year='1999' />
</front>
<seriesInfo name='World Wide Web Consortium Recommendation' value='REC-xpath-19991116' />
<format type='HTML' target='http://www.w3.org/TR/1999/REC-xpath-19991116' />
</reference>
<reference anchor='W3C.REC-xpath20-20101214' target='http://www.w3.org/TR/2010/REC-xpath20-20101214'>
<front>
<title>XML Path Language (XPath) 2.0 (Second Edition)</title>
<author initials='S.' surname='Boag' fullname='Scott Boag'>
<organization />
</author>
<author initials='A.' surname='Berglund' fullname='Anders Berglund'>
<organization />
</author>
<author initials='M.' surname='Kay' fullname='Michael Kay'>
<organization />
</author>
<author initials='J.' surname='Simeon' fullname='Jerome Simeon'>
<organization />
</author>
<author initials='J.' surname='Robie' fullname='Jonathan Robie'>
<organization />
</author>
<author initials='D.' surname='Chamberlin' fullname='Don Chamberlin'>
<organization />
</author>
<author initials='M.' surname='Fernandez' fullname='Mary F. Fernandez'>
<organization />
</author>
<date month='December' day='14' year='2010' />
</front>
<seriesInfo name='World Wide Web Consortium Recommendation' value='REC-xpath20-20101214' />
<format type='HTML' target='http://www.w3.org/TR/2010/REC-xpath20-20101214' />
</reference>
<reference anchor='W3C.REC-xmlschema-1-20041028'
target='http://www.w3.org/TR/2004/REC-xmlschema-1-20041028'>
<front>
<title>XML Schema Part 1: Structures Second Edition</title>
<author initials='H.' surname='Thompson' fullname='Henry S. Thompson'>
<organization />
</author>
<author initials='D.' surname='Beech' fullname='David Beech'>
<organization />
</author>
<author initials='M.' surname='Maloney' fullname='Murray Maloney'>
<organization />
</author>
<author initials='N.' surname='Mendelsohn' fullname='Noah Mendelsohn'>
<organization />
</author>
<date month='October' day='28' year='2004' />
</front>
<seriesInfo name='World Wide Web Consortium Recommendation' value='REC-xmlschema-1-20041028' />
<format type='HTML' target='http://www.w3.org/TR/2004/REC-xmlschema-1-20041028' />
</reference>
</references>
<section title="XSD from RFC 5261" anchor="rfc5261-xsd">
<t>For reference, this section contains a copy of the XML Schema (XSD) <xref target="W3C.REC-xmlschema-1-20041028"/> defining the add, replace, and remove types in RFC 5261 <xref target="RFC5261"/>. This section is informational only, and the definitive version of the schema is the one listed in RFC 5261.</t>
<figure>
<artwork><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE schema [
<!ENTITY ncname "\i\c*">
<!ENTITY qname "(&ncname;:)?&ncname;">
<!ENTITY aname "@&qname;">
<!ENTITY pos "\[\d+\]">
<!ENTITY attr "\[&aname;='(.)*'\]|\[&aname;="(.)*"\]">
<!ENTITY valueq "\[(&qname;|\.)="(.)*"\]">
<!ENTITY value "\[(&qname;|\.)='(.)*'\]|&valueq;">
<!ENTITY cond "&attr;|&value;|&pos;">
<!ENTITY step "(&qname;|\*)(&cond;)*">
<!ENTITY piq "processing-instruction\(("&ncname;")\)">
<!ENTITY pi "processing-instruction\(('&ncname;')?\)|&piq;">
<!ENTITY id "id\(('&ncname;')?\)|id\(("&ncname;")?\)">
<!ENTITY com "comment\(\)">
<!ENTITY text "text\(\)">
<!ENTITY nspa "namespace::&ncname;">
<!ENTITY cnodes "(&text;(&pos;)?)|(&com;(&pos;)?)|((π)(&pos;)?)">
<!ENTITY child "&cnodes;|&step;">
<!ENTITY last "(&child;|&aname;|&nspa;)">
]>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:simpleType name="xpath">
<xsd:restriction base="xsd:string">
<xsd:pattern
value="(/)?((&id;)((/&step;)*(/&last;))?|(&step;/)*(&last;))"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="xpath-add">
<xsd:restriction base="xsd:string">
<xsd:pattern
value="(/)?((&id;)((/&step;)*(/&child;))?|(&step;/)*(&child;))"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="pos">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="before"/>
<xsd:enumeration value="after"/>
<xsd:enumeration value="prepend"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="type">
<xsd:restriction base="xsd:string">
<xsd:pattern value="&aname;|&nspa;"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="add">
<xsd:complexContent mixed="true">
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:any processContents="lax" namespace="##any"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="sel" type="xpath-add"
use="required"/>
<xsd:attribute name="pos" type="pos"/>
<xsd:attribute name="type" type="type"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="replace">
<xsd:complexContent mixed="true">
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:any processContents="lax" namespace="##any"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="sel" type="xpath" use="required"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:simpleType name="ws">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="before"/>
<xsd:enumeration value="after"/>
<xsd:enumeration value="both"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="remove">
<xsd:attribute name="sel" type="xpath" use="required"/>
<xsd:attribute name="ws" type="ws"/>
</xsd:complexType>
</xsd:schema>]]></artwork>
</figure>
</section>
<section title="ABNF for RFC 5261" anchor="rfc5261-abnf">
<t>RFC 5261 <xref target="RFC5261"/> does not contain an ABNF grammar for the allowed subset of XPath expressions, but includes an XSD-based grammar in its type definition for operation types (which is shown in <xref target="rfc5261-xsd"/>). In order to make implementation easier, this appendix contains an ABNF grammar that has been derived from the XSD expressions given in RFC 5261. In the following grammar, "xpath" is the definition for the allowed XPath expressions for remove and replace operations, and "xpath-add" is the definition for the allowed XPath expressions for add operations. The names of all grammar productions are the ones used in the XSD-based grammar of RFC 5261.</t>
<figure>
<artwork>ncname = 1*%x00-ffffffff
qname = [ ncname ":" ] ncname
aname = "@" qname
pos = "[" 1*DIGIT "]"
attr = ( "[" aname "='" 1*%x00-ffffffff "']" ) / ( "[" aname "=" DQUOTE 1*%x00-ffffffff DQUOTE "]" )
valueq = "[" ( qname / "." ) "=" DQUOTE 1*%x00-ffffffff DQUOTE "]"
value = ( "[" ( qname / "." ) "='" 1*%x00-ffffffff "']" ) / valueq
cond = attr / value / pos
step = ( qname / "*" ) 0*( cond )
piq = "processing-instruction(" [ DQUOTE ncname DQUOTE ] ")"
pi = ( "processing-instruction(" [ "'" ncname "'" ] ")" ) / piq
id = ( "id(" [ "'" ncname "'" ] ")" ) / ( "id(" [ DQUOTE ncname DQUOTE ] ")" )
com = "comment()"
text = "text()"
nspa = "namespace::" ncname
cnodes = ( text / com / pi ) [ pos ]
child = cnodes / step
last = child / aname / nspa
xpath = [ "/" ] ( ( id [ 0*( "/" step ) "/" last ] ) / ( 0*( step "/" ) last ) )
xpath-add = [ "/" ] ( ( id [ 0*( "/" step ) "/" child ] ) / ( 0*( step "/" ) child ) )</artwork>
</figure>
</section>
<section title="Acknowledgements">
<t>Thanks for comments and suggestions provided by Bas de Bakker.</t>
</section>
</back>
</rfc>
| PAFTECH AB 2003-2026 | 2026-04-24 05:22:00 |