Re: [xml] Base URI and symbolic links

On Wed, Mar 13, 2002 at 11:46:02AM +0100, Neven Has wrote:

In the situation like:

    symbolic_link.xml -> test/doc.xml

when parsing symbolic_link.xml, the library tries (and fails) to load
doc.dtd, using the current directory as a base.

("doc.xml" refers to just plain "doc.dtd")

RFC-2396 says:

5.1.3. Base URI from the Retrieval URI

   If no base URI is embedded and the document is not encapsulated
   within some other entity (e.g., the top level of a composite entity),
   then, if a URI was used to retrieve the base document, that URI shall
   be considered the base URI.  Note that if the retrieval was the
   result of a redirected request, the last URI used (i.e., that which
   resulted in the actual retrieval of the document) is the base URI.

Now, is symbolic link a "redirected request"? If yes, should the base
URI be a test/ instead?

  I don't think so. the case of a redirected request is the following:

  You ask the server for a resource (like HTTP)
  The server replies back that the resource has moved this include providing
     the new name.
  You ask the server for the new resource.

For example an internal redirect in the HTTP server has not that property of
giving back the new name to the client. It is not considered a redirrect
from RFC2396 viewpoint.

This is the same for symlinks, open() does not indicate that another
path should be used, it provides the content transparently. It is hence
not a redirrect in my opinion, and the current behaviour is correct I think.

Also in practice if you don't have the new name, how would you update the
base ? Except by trying to look at other filesystem metadata, but it's
not part of the base file access API, not portable, and semantically
wrong IMHO.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]