< draft-wilde-xml-patch-00.txt   draft-wilde-xml-patch-01.txt >
Network Working Group E. Wilde Network Working Group E. Wilde
Internet-Draft EMC Internet-Draft EMC
Intended status: Standards Track M. Nottingham Intended status: Standards Track January 16, 2013
Expires: July 18, 2013 Akamai Expires: July 20, 2013
January 14, 2013
A Media Type for XML Patch Operations A Media Type for XML Patch Operations
draft-wilde-xml-patch-00 draft-wilde-xml-patch-01
Abstract Abstract
The XML Patch media type "application/xml-patch" defines an XML The XML Patch media type "application/xml-patch+xml" defines an XML
document structure for expressing a sequence of patch operations that document structure for expressing a sequence of patch operations that
are applied to an XML document. The XML Patch document format's are applied to an XML document. The XML Patch document format's
foundations are defined in RFC 5261, this specification defines a foundations are defined in RFC 5261, this specification defines a
document format and a media type registration, so that XML Patch document format and a media type registration, so that XML Patch
documents can be labeled with a media type, for example in HTTP documents can be labeled with a media type, for example in HTTP
conversations. conversations.
Note to Readers Note to Readers
This draft should be discussed on the apps-discuss mailing list [8]. This draft should be discussed on the apps-discuss mailing list [8].
skipping to change at page 1, line 43 skipping to change at page 1, line 42
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on July 18, 2013. This Internet-Draft will expire on July 20, 2013.
Copyright Notice Copyright Notice
Copyright (c) 2013 IETF Trust and the persons identified as the Copyright (c) 2013 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
2. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 3 2. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 3
3. Patch Document Format . . . . . . . . . . . . . . . . . . . . . 4 3. Patch Document Format . . . . . . . . . . . . . . . . . . . . 4
4. Patch Examples . . . . . . . . . . . . . . . . . . . . . . . . 5 4. Patch Examples . . . . . . . . . . . . . . . . . . . . . . . . 5
5. Security Considerations . . . . . . . . . . . . . . . . . . . . 6 5. Security Considerations . . . . . . . . . . . . . . . . . . . 6
6. References . . . . . . . . . . . . . . . . . . . . . . . . . . 6 6. Change Log . . . . . . . . . . . . . . . . . . . . . . . . . . 6
6.1. Normative References . . . . . . . . . . . . . . . . . . . 6 6.1. From -00 to -01 . . . . . . . . . . . . . . . . . . . . . 6
6.2. Informative References . . . . . . . . . . . . . . . . . . 6 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7.1. Normative References . . . . . . . . . . . . . . . . . . . 6
7.2. Informative References . . . . . . . . . . . . . . . . . . 7
Appendix A. XSD from RFC 5261 . . . . . . . . . . . . . . . . . . 7 Appendix A. XSD from RFC 5261 . . . . . . . . . . . . . . . . . . 7
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 9 Appendix B. ABNF for RFC 5261 . . . . . . . . . . . . . . . . . . 9
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 10
1. Introduction 1. Introduction
The Extensible Markup Language (XML) [1] is a common format for the The Extensible Markup Language (XML) [1] is a common format for the
exchange and storage of structured data. HTTP PATCH [6] extends HTTP exchange and storage of structured data. HTTP PATCH [6] extends HTTP
[7] with a method to perform partial modifications to resources. [7] with a method to perform partial modifications to resources.
HTTP PATCH requires that patch documents are being sent along with HTTP PATCH requires that patch documents are being sent along with
the request, and it is therefore useful if there are standardized the request, and it is therefore useful if there are standardized
patch document formats (identified by media types) for popular media patch document formats (identified by media types) for popular media
types. types.
The XML Patch media type "application/xml-patch" is an XML document The XML Patch media type "application/xml-patch+xml" is an XML
structure for expressing a sequence of operations to apply to a document structure for expressing a sequence of operations to apply
target XML document, suitable for use with the HTTP PATCH method. to a target XML document, suitable for use with the HTTP PATCH
Servers can freely choose which patch formats they want to accept, method. Servers can freely choose which patch formats they want to
and "application/xml-patch" could be a simple default format that can accept, and "application/xml-patch+xml" could be a simple default
be used unless a server decides to use a different (maybe more format that can be used unless a server decides to use a different
sophisticated) patch format for XML. (maybe more sophisticated) patch format for XML.
The format for patch documents is based on the XML Patch Framework The format for patch documents is based on the XML Patch Framework
defined in RFC 5261 [2]. While RFC 5261 does define a concrete defined in RFC 5261 [2]. While RFC 5261 does define a concrete
syntax as well as the media type "application/patch-ops-error+xml" syntax as well as the media type "application/patch-ops-error+xml"
for error documents, it only defines XSD types for patch operations, for error documents, it only defines XSD types for patch operations,
and thus the concrete document format and the media type for patch and thus the concrete document format and the media type for patch
operations are defined in an XSD defined in this specification. operations are defined in an XSD defined in this specification.
2. IANA Considerations 2. IANA Considerations
The Internet media type [3] for an XML Patch Document is application/ The Internet media type [3] for an XML Patch Document is application/
xml-patch. xml-patch+xml.
Type name: application Type name: application
Subtype name: xml-patch Subtype name: xml-patch+xml
Required parameters: none Required parameters: none
Optional parameters: Same as charset parameter for the media type Optional parameters: Same as charset parameter for the media type
"application/xml" as specified in RFC 3023 [1]. "application/xml" as specified in RFC 3023 [1].
Encoding considerations: Same as encoding considerations of media Encoding considerations: Same as encoding considerations of media
type "application/xml" as specified in RFC 3023 [1]. type "application/xml" as specified in RFC 3023 [1].
Security considerations: This media type has all of the security Security considerations: This media type has all of the security
skipping to change at page 5, line 26 skipping to change at page 5, line 26
<p:add sel="*/elem[@a='bar']" type="@b">new attr</p:add> <p:add sel="*/elem[@a='bar']" type="@b">new attr</p:add>
</p:patch> </p:patch>
As this example demonstrates, both the document element "patch" and As this example demonstrates, both the document element "patch" and
the patch operation elements are in the same XML namespace. This is the patch operation elements are in the same XML namespace. This is
the result of RFC 5261 only defining types for the patch operation the result of RFC 5261 only defining types for the patch operation
elements, which then can be reused in schemas to define concrete elements, which then can be reused in schemas to define concrete
patch elements. patch elements.
RFC 5261 defines an XML Schema (XSD) for the patch operation types, RFC 5261 defines an XML Schema (XSD) for the patch operation types,
which is included for reference Appendix A. The normative version of which is included for reference in Appendix A. The normative version
this schema is the one given in RFC 5261. The following schema for of this schema is the one given in RFC 5261. The following schema
the XML Patch media type is based on the types defined in RFC 5261, for the XML Patch media type is based on the types defined in RFC
which are imported as "rfc5261.xsd" in the following schema. The 5261, which are imported as "rfc5261.xsd" in the following schema.
schema defines a "patch" document element, and then allows an The schema defines a "patch" document element, and then allows an
unlimited (and possible empty) sequence of the "add", "remove", and unlimited (and possible empty) sequence of the "add", "remove", and
"replace" operation elements, which are directly based on the "replace" operation elements, which are directly based on the
respective types from the schema defined in RFC 5261. respective types from the schema defined in RFC 5261.
<xs:schema targetNamespace="urn:ietf:rfc:XXXX" <xs:schema targetNamespace="urn:ietf:rfc:XXXX"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:import schemaLocation="rfc5261.xsd"/> <xs:import schemaLocation="rfc5261.xsd"/>
<xs:element name="patch"> <xs:element name="patch">
<xs:complexType> <xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="add" type="add"/> <xs:element name="add" type="add"/>
skipping to change at page 6, line 13 skipping to change at page 6, line 13
5261, please refer to the numerous examples in that specification for 5261, please refer to the numerous examples in that specification for
concrete XML patch document examples. Most importantly, the examples concrete XML patch document examples. Most importantly, the examples
in RFC 5261 can be taken literally as examples for the XML Patch 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 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". operation elements in these examples is the URI "urn:ietf:rfc:XXXX".
5. Security Considerations 5. Security Considerations
... ...
6. References 6. Change Log
6.1. Normative References Note to RFC Editor: Please remove this section before publication.
6.1. From -00 to -01
o Removed Mark Nottingham from author list.
o Changed media type name to application/xml-patch+xml (added suffix
per draft-ietf-appsawg-media-type-suffix-regs)
o Added ABNF grammar derived from XSD (Appendix B)
7. References
7.1. Normative References
[1] Murata, M., St. Laurent, S., and D. Kohn, "XML Media Types", [1] Murata, M., St. Laurent, S., and D. Kohn, "XML Media Types",
RFC 3023, January 2001. RFC 3023, January 2001.
[2] Urpalainen, J., "An Extensible Markup Language (XML) Patch [2] Urpalainen, J., "An Extensible Markup Language (XML) Patch
Operations Framework Utilizing XML Path Language (XPath) Operations Framework Utilizing XML Path Language (XPath)
Selectors", RFC 5261, September 2008. Selectors", RFC 5261, September 2008.
[3] Freed, N. and J. Klensin, "Media Type Specifications and [3] Freed, N. and J. Klensin, "Media Type Specifications and
Registration Procedures", BCP 13, RFC 4288, December 2005. Registration Procedures", BCP 13, RFC 4288, December 2005.
[4] Freed, N. and N. Borenstein, "Multipurpose Internet Mail [4] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Extensions (MIME) Part One: Format of Internet Message Bodies", Extensions (MIME) Part One: Format of Internet Message Bodies",
RFC 2045, November 1996. RFC 2045, November 1996.
[5] Freed, N. and N. Borenstein, "Multipurpose Internet Mail [5] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Extensions (MIME) Part Two: Media Types", RFC 2046, Extensions (MIME) Part Two: Media Types", RFC 2046,
November 1996. November 1996.
6.2. Informative References 7.2. Informative References
[6] Dusseault, L. and J. Snell, "PATCH Method for HTTP", RFC 5789, [6] Dusseault, L. and J. Snell, "PATCH Method for HTTP", RFC 5789,
March 2010. March 2010.
[7] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., [7] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L.,
Leach, P., and T. Berners-Lee, "Hypertext Transfer Protocol -- Leach, P., and T. Berners-Lee, "Hypertext Transfer Protocol --
HTTP/1.1", RFC 2616, June 1999. HTTP/1.1", RFC 2616, June 1999.
URIs URIs
skipping to change at page 9, line 9 skipping to change at page 9, line 26
</xsd:restriction> </xsd:restriction>
</xsd:simpleType> </xsd:simpleType>
<xsd:complexType name="remove"> <xsd:complexType name="remove">
<xsd:attribute name="sel" type="xpath" use="required"/> <xsd:attribute name="sel" type="xpath" use="required"/>
<xsd:attribute name="ws" type="ws"/> <xsd:attribute name="ws" type="ws"/>
</xsd:complexType> </xsd:complexType>
</xsd:schema> </xsd:schema>
Authors' Addresses Appendix B. ABNF for RFC 5261
RFC 5261 [2] 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 Appendix A). 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.
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 ) )
Author's Address
Erik Wilde Erik Wilde
EMC EMC
Email: erik.wilde@emc.com Email: erik.wilde@emc.com
Mark Nottingham
Akamai
Email: mnot@mnot.net
 End of changes. 16 change blocks. 
31 lines changed or deleted 80 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/