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 7072 - [F&O] Error codes for fn:collection
Summary: [F&O] Error codes for fn:collection
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 1.0 (show other bugs)
Version: Proposed Edited Recommendation
Hardware: PC Windows NT
: 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: 2009-07-01 10:44 UTC by Oliver Hallam
Modified: 2009-09-15 16:18 UTC (History)
1 user (show)

See Also:


Attachments

Description Oliver Hallam 2009-07-01 10:44:19 UTC
fn:doc uses two distinct error codes:
FODC0002 - Error retrieving resource
FODC0005 - Invalid argument

I interpret this to mean that if a URI is not understood then an FODC0005 error is raised, and if the document could not be read or is invalid then an FODC0002 error is raised.  For instance an implementation might understand an http:// URI, but retrieving the document gets a 404.  I understand this to be an FODC0002.

fn:collection limits the use of FODC0002 for the default collection not being defined and FODC0004 for "invalid argument" (i.e. URI not understood).

However there is also the case of the argument being fine, but an error occurring retrieving the collection(for example the use case of retrieving documents in a directory).  In this case the mapping from URI to collection is defined so FODC0004 is inappropriate.  I suggest that an FODC0002 should be acceptable in this case too.
Comment 1 Michael Kay 2009-08-27 21:23:56 UTC
ACTION A-405-01

For fn:doc(), FODC0002 is really a bit of a fudge. The theory is that the dynamic context defines a mapping from URIs to nodes; in that pure theory there are no dereferencing or parsing operations, and therefore no scope for FODC0002 to occur. The existence of the error code reflects the pragmatic reality that we all know fn:doc() will in actually do dereferencing and parsing, and these operations may fail.

The bug report is asking for similar pragmatism for fn:collection(), which seems reasonable. In action A-405-01 I was asked to produce wording to implement this, and I think the most sensible thing to do is to use similar wording to that of the fn:doc() function:

<proposedText>
One possible processing model for this function is as follows. The collection URI is dereferenced to yield a resource that provides a set of document URIs. If this dereferencing operation fails, an error is raised [err:FODC0002]. The set of document URIs is then mapped to a set of document nodes by applying the fn:doc function. If this operation fails for any reason in respect of any URI, the error code raised by the fn:doc function is propagated as an error result from the fn:collection function. For example, a parsing or schema validation error in any of the documents would result in error FODC0002 being raised.
</proposedText>

The astute reader will notice that this anticipates the model assumed by the proposed uri-collection() function. However, it's careful not to rule out other processing models.
Comment 2 Michael Kay 2009-09-15 15:31:46 UTC
This solution was accepted on the call on 15 Sept 2009.
Comment 3 Oliver Hallam 2009-09-15 16:18:49 UTC
Agree with solution -- am marking as closed.