[topicmapmail] xml:base and #foo URIs

Thomas B. Passin tpassin@comcast.net
Tue, 22 Apr 2003 21:23:47 -0400


[Lars Marius Garshol]
>
> | In his paragraph beginning "The document infoitem's [base URI]
> | property..." you'll see where xml:base operates, by redefining
> | the base URI.
>
> I know that. What I'm saying is that as far as I can tell,
> same-document references are not resolved relative to the base URI,
> but relative to the document URI. If you have reason to think
> differently, could you tell me why? I'm not 100% convinced either way
> here, but I would like to be.
>

So far as the RFC is concerned, the fragment identifier is brought into play
only after a URI reference is fully resolved:

" The term "URI-reference" is used here to denote the common usage of a
   resource identifier.  A URI reference may be absolute or relative,
   and may have additional information attached in the form of a
   fragment identifier.  However, "the URI" that results from such a
   reference includes only the absolute URI after the fragment
   identifier (if any) is removed and after any relative URI is resolved
   to its absolute form"

We also know that relative URIs are to be resolved to the document URI if
there is nothing else known to the user agent.  This would cover bare
fragment identifiers (which become in-document references) in the absence of
xml:base -

" 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."


The XML Base Rec says

"  The base URI corresponding to a given relative URI appearing in an XML
document is determined as follows:
a.. The base URI for a URI reference appearing in text content is the base
URI of the element containing the text.

a.. The base URI for a URI reference appearing in an xml:base attribute is
the base URI of the parent element of the element bearing the xml:base
attribute, if one exists within the document entity or external entity,
otherwise the base URI of the document entity or external entity containing
the element.

a.. The base URI for a URI reference appearing in any other attribute value,
including default attribute values, is the base URI of the element bearing
the attribute."

This Rec is aligned with the RFC, and the RFC prescribes how to resolve a
URI with a fragment identifier.  There is really no ambiguity as to the URI
+ fragment identifier resolution, so far as I can see.

However, what the application __does__ with the fragment identifier after
URI resolution is another matter.  Either it is determined by the media type
or by the application otherwise, according the the RFC.  For topic maps, I
do not see that we _must_ (by the RFC or XML Base) regard one as an xpointer
bare id, but on the other hand we could if we want to, which I imagine we
would.



To sum up, between the RFC and XML Base, I see it as very clear that a bare
fragment identifier refers to a location in the base uri of the context
element, and that would be an in-document reference if there is no other
base uri established.

Cheers,

Tom P