W3C home > Mailing lists > Public > uri@w3.org > January 2002

Re: Base URIs vs. Document URIs.

From: Jason Diamond <jason@injektilo.org>
Date: Fri, 11 Jan 2002 11:06:09 -0800
Message-ID: <001d01c19ad3$0d6abb00$02265fa6@ck3162154a>
To: <uri@w3.org>
> I'm gathering you want resolveURI to take any URI ref and return an
> absolute URI reference.

Yes.

> Instead, what I would do is define resolveURI as a function that
> takes any URI-reference-up-to-but-not-including-the-fragment-id [1] and
> returns the appropriate absolute URI.  The fragment id part is never
> sent to resolveURI and is always re-appended to what resolveURI returns
[2].

I based my implementation on the example algorithm in Section 5.2. Despite
being titled "Resolving Relative References to Absolute Form", it does cover
non-relative URI references (see step 3). Step 2 covers the case where the
URI reference is the empty string or just a fragment identifier. In that
case, it states the the reference is a "reference to the current document
and we are done".

Hmm. Looking at this paragraph again, I now think that it might be slightly
flawed. It says "and we are done". It doesn't mention that the fragment
identifier, if present, should be appended to the URI of the current
document.

> In this model, if resolveURI is handed a null string, it just returns
> a null string and the calling code would know to use the fragment id
> to access into the current resource without anyone having to talk
> about a document URI (which may not exist if, say, you're working
> on some in-memory view of a dynamic document--and even if there is
> such a URI, you wouldn't want to use the URI to do a fetch of the
> document that is the current one anyway).

I'm fairly certain that my implementation will produce the correct result as
would the model that you suggest above. It passes all of the tests in
Appendix C. I'm actually working on an RDF parser (in XSLT) so am not
fetching any resources but I do need to convert all URI references to their
absolute form and would like that encapsulated into a single function.

I really appreciate you taking the time to discuss this with me.

Jason
Received on Friday, 11 January 2002 14:10:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 13 January 2011 12:15:30 GMT