Subject: [Simple] [Technical Errata Reported] RFC5261 (3477)

From: RFC Errata System <[email-masked]>
Date: Tue, 5 Feb 2013 02:25:14 -0800 (PST)

The following errata report has been submitted for RFC5261,
"An Extensible Markup Language (XML) Patch Operations Framework Utilizing XML Path Language (XPath) Selectors".

--------------------------------------
You may review the report below and at:
http://www.rfc-editor.org/errata_search.php?rfc=5261&eid=3477

--------------------------------------
Type: Technical
Reported by: Erik Wilde <[email-masked]>

Section: 4.2.2

Original Text
-------------
In XPath 2.0, a "bar" selector
not only matches an unqualified <bar> element, but also matches a
qualified <bar> element that is in scope of a default namespace
declaration.  In contrast, in this specification, a selector without
a prefix only matches one element, and it may match an element with
or without a prefix but only if the namespace it's qualified with (or
none) is an exact match.

Corrected Text
--------------
In XPath 2.0, a "bar" selector matches elements that have the URI of the "default element/type namespace", which is part of an XPath's static context. By setting this URI to the default namespace of the diff document (or leave it empty, if there is none), XPath 2.0's behavior matches the requirements of the previous section.

Notes
-----
The original text is not easy to understand, but seems to assume that an unprefixed name in XPath 2.0 matches both unprefixed names, and prefixed ones that have the same namespace than the default namespace of the XPath static context. This is not the case: Matching depends on how the "default element/type namespace" of the XPath static context is defined, and then matches either namespace-less elements, or those in the "default element/type namespace", but never both. This context, however, is defined by the XPath itself, not by the document. Thus, it can be set externally and could be set to the diff document's default namespace (if there is one). In that case, XPath 2.0 can be used to evaluate XML Patch selectors.

Instructions:
-------------
This errata is currently posted as "Reported". If necessary, please
use "Reply All" to discuss whether it should be verified or
rejected. When a decision is reached, the verifying party (IESG)
can log in to change the status and edit the report, if necessary. 

--------------------------------------
RFC5261 (draft-ietf-simple-xml-patch-ops-04)
--------------------------------------
Title               : An Extensible Markup Language (XML) Patch Operations Framework Utilizing XML Path Language (XPath) Selectors
Publication Date    : September 2008
Author(s)           : J. Urpalainen
Category            : PROPOSED STANDARD
Source              : SIP for Instant Messaging and Presence Leveraging Extensions
Area                : Real-time Applications and Infrastructure
Stream              : IETF
Verifying Party     : IESG

---

From: Bjoern Hoehrmann <[email-masked]>
Date: Tue, 05 Feb 2013 12:16:58 +0100

>Notes
>-----
>The original text is not easy to understand, but seems to assume that
>an unprefixed name in XPath 2.0 matches both unprefixed names, and 
>prefixed ones that have the same namespace than the default namespace of 
>the XPath static context. This is not the case: Matching depends on how 
>the "default element/type namespace" of the XPath static context is 
>defined, and then matches either namespace-less elements, or those in 
>the "default element/type namespace", but never both. This context, 
>however, is defined by the XPath itself, not by the document. Thus, it 
>can be set externally and could be set to the diff document's default 
>namespace (if there is one). In that case, XPath 2.0 can be used to 
>evaluate XML Patch selectors.

Indeed, see <http://www.w3.org/TR/xpath20/#node-tests>, 3rd paragraph.

(I do note that this is not the only difference between XPath 1.0 and
XPath 2.0, so the conclusion that then XPath 2.0 can be used to evalu-
ate XML Patch selectors is not necessarily correct, especially if it
cannot be assumed that defaults like "Default element/type namespace"
cannot be assumed to be chosen to maximise compatibility. But that is
out of scope of the Original Text this item is concerned with.)
-- 
Björn Höhrmann · mailto:[email-masked] · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

---

From: Erik Wilde <[email-masked]>
Date: Tue, 05 Feb 2013 14:17:34 +0100

hello bjoern.

thanks a lot for the quick feedback!

> out of scope of the Original Text this item is concerned with.)

yes, you're right that this is not necessarily a correct conclusion. it 
would be really great to figure this out, though, because the 
convenience of being able to use a standard implementation cannot be 
overstated. i am writing 
http://tools.ietf.org/html/draft-wilde-xml-patch-01 which is intended to 
be based on RFC 5261 (which is why am reading it very closely now), and 
it would be great to have an implementation hints section (i am 
currently writing one) that would clearly tell implementers what they 
can and cannot use. it's bad enough that you cannot use a standard XPath 
1.0 implementation; it would be great if at least XPath 2.0 would be 
usable. any insights would be greatly appreciated, i think i have to 
look closer into the XPath subset of the RFC and see whether that 
contains anything where XPath 1.0 and 2.0 differ.

in the interest of readability, 
http://tools.ietf.org/html/draft-wilde-xml-patch-01#appendix-B now has 
an ABNF for the grammar in RFC 5261, where it's only defined in the XSD. 
i have also filed an erratum about the grammar, because it allows 
"id()", which never selects anything:

http://www.rfc-editor.org/errata_search.php?rfc=5261&eid=3458

thanks again and cheers,

dret.

-- 
erik wilde | mailto:[email-masked]  -  tel:+1-510-2061079 |
            | UC Berkeley  -  School of Information (ISchool) |
            | http://dret.net/netdret http://twitter.com/dret |