Re: Base URIs vs. Document URIs.

> 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 UTC