This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 10795 - provide alternate results for K2-SeqDocFunc-7 and K2-SeqDocFunc-8
Summary: provide alternate results for K2-SeqDocFunc-7 and K2-SeqDocFunc-8
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.1 (show other bugs)
Version: Proposed Recommendation
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-28 18:56 UTC by Sorin Nasoi
Modified: 2016-03-22 10:13 UTC (History)
3 users (show)

See Also:


Attachments

Description Sorin Nasoi 2010-09-28 18:56:34 UTC
Due to the fact that a Windows file path is an invalid URI to fn:doc(), FODC0005 should be added as an alternate result for both tests.

At the moment only FODC0002 is an accepted result.

here are some links to the documentation:
- http://www.w3.org/TR/xpath-functions-11/#func-doc section "Error Conditions"

- http://dev.w3.org/cvsweb/~checkout~/2006/xquery-test-suite/TestSuiteStagingArea/XQTSCatalog.xml#K2-SeqDocFunc-7

- http://dev.w3.org/cvsweb/~checkout~/2006/xquery-test-suite/TestSuiteStagingArea/XQTSCatalog.xml#K2-SeqDocFunc-8
Comment 1 Michael Kay 2010-09-28 23:04:34 UTC
I have some sympathy because (a) the distinction between FODC0002 and FODC0005 is extremely and unnecessarily subtle; (b) the RFCs are pretty impenetrable as to what the exact rules are, (c) the RFC's seem to differ from each other, and (d) our specs are sometimes fuzzy as to which RFC wins. 

See for example http://www.highdots.com/forums/html/rfc3986-backslash-uri-urls-178316.html

However, I believe that under the definition of "URI" contained in F+O PER section 1.7, both abc\def and \abc\def are valid:

Within this specification, the term "URI" refers to Universal Resource Identifiers as defined in [RFC 3986] and extended in [RFC 3987] with a new name "IRI". The term "URI Reference", unless otherwise stated, refers to a string in the lexical space of the xs:anyURI datatype as defined in [XML Schema Part 2: Datatypes Second Edition]. Note that this means, in practice, that where this specification requires a "URI Reference", an IRI as defined in [RFC 3987] will be accepted, provided that other relevant specifications also permit an IRI. The term URI has been retained in preference to IRI to avoid introducing new names for concepts such as "Base URI" that are defined or referenced across the whole family of XML specifications. Note also that the definition of xs:anyURI is a wider definition than the definition in [RFC 3987]; for example it does not require non-ASCII characters to be escaped.

I note in passing that the spec of fn:doc() (like many other places in our specs) occasionally uses "URI" when it means "URI Reference" (thus apparently disallowing relative references) but I don't think many readers will be misled by this and it's not directly pertinent to this bug report. Equally, I find it hard to see why the above paragraph defines "URI" by reference to RFC 3987, and "URI Reference" by reference to XSD 1.0 Part 2.

So: I have sympathy with your argument, but only really on the basis that the distinction between FODC0002 and FODC0005 is too subtle for us to reasonably expect implementors to get it right - and if that's the case, we should get rid of the distinction.

Michael Kay
Comment 2 Debbie Lockett 2015-10-02 13:14:36 UTC
Transferring this unclosed bug to QT3. The issue is still relevant.
Comment 3 Michael Kay 2015-10-02 14:21:39 UTC
Note a subtle distinction: in the spec of fn:doc, it says:

A dynamic error may be raised [err:FODC0005] if $uri is not a valid URI.

while in the non-normative Appendix B it says

err:FODC0005, Invalid argument to fn:doc or fn:doc-available.
Raised (optionally) by fn:doc and fn:doc-available if the argument is not a valid xs:anyURI.

Neither is quite right. We should say "a valid URI Reference". 

(a) xs:anyURI is a much wider category than URI, since it also allows IRIs, LEIRIs, and on some interpretations, any sequence of characters.

(b) We certainly don't intend to exclude things like "source.xml" that are valid URI references but not valid URIs.

The characters that can appear in a segment of the "path" part of a URI are

pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"

This set does not include backslash.

Therefore the strings passed to doc() in these two tests are not valid URI References and therefore FODC0005 is an acceptable result.

I propose also to change the specification so that

(a) Under fn:doc(), first error condition, change "URI" to "URI Reference"

(b) In the Appendix description of FODC0005, change "valid xs:anyURI" to "valid URI Reference".
Comment 4 Michael Kay 2015-10-06 17:36:30 UTC
The changes to the spec were approved and have been applied.
Comment 5 Michael Kay 2015-10-06 17:43:29 UTC
The changes to test cases have also been applied.