- From: Paul Grosso <pgrosso@arbortext.com>
- Date: Fri, 11 Jan 2002 11:48:00 -0600
- To: "Jason Diamond" <jason@injektilo.org>, <uri@w3.org>
At 08:46 2002 01 11 -0800, Jason Diamond wrote: >> >Is there any way to resolve something like "#s" against the base URI and >not >> >the document URI? >> >> I'd suggest that you shouldn't be calling resolveURI at all in the case >> that the relative URI reference is merely a fragment identifier. There >> is nothing to resolve. > >I need some function that accepts a URI reference and returns a URI. If you >know of a more appropriate name than resolveURI then I would be happy to use >it. I only chose resolveURI since Appendix C uses the term resolve and it >includes the example of the URI reference "#s". I'm gathering you want resolveURI to take any URI ref and return an absolute URI reference. 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]. 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 only asked the question out of pure curiosity--I don't think I would ever >need to do it. > >But just so I understand, let's say that my document URI is ><http://example.org/document.xml> and my base URI is ><http://example.org/base.xml> and I want to resolve to ><http://example.org/base.xml#fragment>, the only URI reference that I can >think of that would get me what I want is <base.xml#fragment> because if I >used <#fragment>, it would get resolved to ><http://example.org/document.xml#fragment>. Is this correct? Al already gave an extended answer. Briefly, you've got the idea: relative URI refs consisting only of the fragment id are different in that they are not affected by the base URI, they are always relative to the current resource. paul [1] RFC 2396 doesn't have a term to describe this. Rather, it has: URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] and so I am referring to the "[ absoluteURI | relativeURI ]" part. [2] TimBL talks about putting the fragment identifier in your back pocket, resolving the rest of the URI reference into a resource, then taking the fragment id out of your back pocket and using it to access into the resource.
Received on Friday, 11 January 2002 12:48:42 UTC