Re: URL resolution sanity check

At 08:25 19/07/05 -0400, Elliotte Harold wrote:


>I need to confirm something. Consider the following situation:
>
><parent xml:base="http://www.example.com/data/limit/..">
>   <child xml:base="test.xml"/>
></parent>
>
>Is the base URL of the child element
>http://www.example.com/data/limit/test.xml or
>http://www.example.com/data/test.xml ?

I think it's "http://www.example.com/data/limit/test.xml"
So does my software.

>In other words, is http://www.example.com/data/limit/.. essentially the
>same as http://www.example.com/data/limit/../ or not?

Not.

>Both the algorithms in RFC 2396 and 3RFC 986 seem to indicate that the 
>result is http://www.example.com/data/limit/test.xml, not 
>http://www.example.com/data/test.xml. I'm not sure if:
>
>A. I'm misreading the algorithm

I agree with your reading.
As for the rest, I can't really say what was intended, but I'm happy enough 
with this position.  (But checking this case did expose a subtle bug in my
relative reference finding code, not being an exact inverse of the relative 
resolution code.)

#g
--

>B. This is a bug in the algorithm
>C. This is an often unrecognized but intended consequence of the specification
>
>The problem is that both 2396 and 3986 remove the segment following the 
>last slash *before* removing dot segments. Thus 
>http://www.example.com/data/limit/.. and 
>http://www.example.com/data/limit/../ do not get treated the same.
>
>Perhaps there is a way out of this. If removal of dot segments were 
>applied to *all* URIS, not just at the resolution step, then we could say 
>that the base URI of <parent 
>xml:base="http://www.example.com/data/limit/.."/> was actually 
>http://www.example.com/data/, not http://www.example.com/data/limit/.. In 
>this case the relative resolution works as we expect. However, I can find 
>no justification for that leap in XML Base, XML Infoset, or RFC 3986.
>
>This would affect other URIs as well. For instance, what is the base URI of
>
><foo xml:base="http://www.example.com/test/.././data.xml" /> ? Is it 
>http://www.example.com/test/.././data.xml or 
>http://www.example.com/data.xml? This one may be academic, but in the case 
>I originally proposed, you could actually end up linking 
>to/including/loading a different document depending on how you handle this.
>
>I suspect similar issues apply with an HTML BASE element as well. Possibly 
>there are other cases where this may apply.
>
>--
>Elliotte Rusty Harold  elharo@metalab.unc.edu
>XML in a Nutshell 3rd Edition Just Published!
>http://www.cafeconleche.org/books/xian3/
>http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim

------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

Received on Tuesday, 19 July 2005 22:09:04 UTC