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

Re: #foo URI references

From: Roy T. Fielding <fielding@gbiv.com>
Date: Fri, 30 Jan 2004 15:08:37 -0800
Cc: Paul Grosso <pgrosso@arbortext.com>, uri@w3.org
To: Norman Walsh <Norman.Walsh@Sun.COM>
Message-Id: <3C0810E5-5379-11D8-A4B3-000393753936@gbiv.com>

> I think there is a change in meaning, and I think the following example
> demonstrates it:
>
> Let's say that doing a GET on http://example.org/path/doc.xml returns
>
> <doc>
>   <div xml:base="http://example.org/1/a.xml">
>     <p id="x">Some text</p>
>   </div>
>   <div xml:base="http://example.org/2/b.xml">
>     <p id="y"><a href="#x">LinkX</a></p>
>     <p><a href="#y">LinkY</a></p>
>   </div>
> </doc>
>
> The old text says:
>
>    2) If the path component is empty and the scheme, authority, and
>       query components are undefined, then it is a reference to the
>       current document and we are done.
>
> That seems clearly to say that the first link, LinkX, points to
> the "p" with ID "x" in the first div.
>
> Under the new wording, #x becomes http://example.org/2/b.xml#x and it
> seems equally clear that that does not point to the "p" with ID "x" in
> the first div.
>
> That's a change.

http://gbiv.com/protocols/uri/rev-2002/rfc2396bis.html#same-document

Please read what it says carefully:

    When a URI reference occurring within a document or message
    refers to a URI that is, aside from its fragment component
    (if any), identical to the base URI (section 5.1), that reference
    is called a "same-document" reference. The most frequent examples
    of same-document references are relative references that are empty
    or include only the number-sign ("#") separator followed by a
    fragment identifier.

    When a same-document reference is dereferenced for the purpose
    of a retrieval action, the target of that reference is defined
    to be within that current document or message; the dereference
    should not result in a new retrieval.

In your example, the base of the reference "#x" is

    http://example.org/2/b.xml

and the resolved reference is

    http://example.org/2/b.xml#x

which differs from the base only by the fragment component.
Therefore, it is a same-document reference and its behavior will
be EXACTLY the same as prescribed by RFC 2396.

> If we need to make a change, that's fine, or at least, that's a point
> for discussion. But I don't think we can claim not to be making a
> change.

The change that was made is noted in Appendix D.2.  What I am saying
is that this change does not impact documents unless it includes
multiple bases that refer to other documents AND references to those
other documents within their own base using a reference that is
NOT fragment-only.  In other words,

   <doc>
     <div xml:base="http://example.org/1/a.xml">
       <p id="x"><a href="a.xml#y">Link1</a></p>
     </div>
     <div xml:base="http://example.org/2/b.xml">
       <p id="y"><a href="a.xml#y">Link2</a></p>
       <p><a href="#y">LinkY</a></p>
     </div>
   </doc>

under the new interpretation, Link1 is a same-document link.  There
is no known software that relies on Link1 being an other-document
reference for the purpose of a retrieval action.

Under no circumstances does a valid same-document link under RFC 2396
become an other-document link under rfc2396bis.


Cheers,

Roy T. Fielding <http://roy.gbiv.com/>
Received on Friday, 30 January 2004 18:08:13 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:07 UTC