Re: XML Base and URI fragments

I'm not sure I'm understanding all your points, but I'll try to
embed some comments below.

At 11:47 2000 08 03 +0100, Lee Jonas wrote:
>There seems to be no special rules for resolving fragments in Section 4 of
>the XML Base WD.

What do you mean by "resolving fragments?"  "Fragments" is not
really a well-defined term (except by the "XML Fragment Interchange"
specification [1] whose terminology no one really follows), and
regardless of its meaning, I cannot see how one "resolves" them.

My best guess is that you're talking about resolving (in the
sense of converting a relative URI reference into an absolute
one) relative URI references containing (or consisting of?)
fragment identifiers (in the RFC 2396 [2] sense).

>Consider the following example from thisdoc.xml:
>
><myFragment ID="local_fragment"/>
>
><myElt xml:base="http://mydomain.com/thatdoc.xml">
>	<myInnerElt href="#xpointer(id('remote_fragment'))"/>
>	<myInnerElt href="#xpointer(id('local_fragment'))"/>
></myElt>

What you show above isn't a well-formed document.  I will assume
you are showing only an excerpt of thisdoc.xml.

>http://mydomain.com/thatdoc.xml is a valid URI and hence a valid base,

Agreed.  Note that the base URI is "http://mydomain.com/" since,
per RFC 2396, the part following the last "/" is removed when
computing the base URI.  (A base URI is a "directory", to use 
file system terminology, not a "file aka document" itself.)

>but is it dumb to want to use a resource as a base for fragments?

I don't think it's necessarily dumb to use URI as a base, but 
a base URI should be like a "directory" not like a "file".    
I don't know what it means to be a "base for fragments".

I would point out, however, that in your example above, both your
example href attribute values consist *solely* of a fragment identifier.
Therefore, per section 5.2. "Resolving Relative References to Absolute 
Form" point 2 of RFC 2396, to wit:

  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.  

these relative URI references refer to the current document
regardless of the current base URI, so the use of xml:base in
your example above does not affect the resolution of these
relative URI references.

If you wanted to give a fragment identifier that resolved into
a reference using the base URI, you could put "./" in front of
your fragment identifier.

>If so, no problem, I can rewite as:
>
><myFragment ID="local_fragment"/>
>
><myElt xml:base="http://mydomain.com/">
>	<myInnerElt href="thatdoc.xml#xpointer(id('remote_fragment'))"/>
>	<myInnerElt href="#xpointer(id('local_fragment'))"/>
></myElt>

Note that the base URI set by the xml:base in this example is the
same as that set in your previous example.

In this example, the first href does get resolved into:
  http://mydomain.com/thatdoc.xml#xpointer(id('remote_fragment'))
The second one still gets resolved as a reference into the
current document regardless of the base URI.

>If not, assume thatdoc.xml contains elements with IDs of 'remote_fragment'
>and 'local_fragment'.  According to the current 'relative URI' rules, both
>remote_fragment and local_fragment will be resolved by XPointer to point to
>fragments in thatdoc.xml.  

This is not true--see my explanation above.

>How would I indicate I want to refer to
>thisdoc.xml#local_fragment instead of thatdoc.xml#local_fragment?

Within thisdoc.xml, "#local_fragment" refers to thisdoc.xml#local_fragment
regardless of the base URI.  Also within thisdoc.xml, and assuming a base
URI of "http://mydomain.com/", "thatdoc.xml#local_fragment" would refer
to thatdoc.xml#local_fragment.  

>Note that specifying href="thisdoc.xml#xpointer(id('local_fragment'))" would
>be unacceptable:  it may cause an application / browser to reload
>thisdoc.xml.

Within thisdoc.xml and assuming a base URI of "http://mydomain.com/", 
"thisdoc.xml#local_fragment" would resolve to the exact same thing
as "#local_fragment"; there is nothing at all wrong with this.  If 
that causes the application/browser to do something unacceptable,
that is a bug in the application/browser.

>If resources can be specified as base URIs then should XBase section 4 be
>revised to cater for this?

I don't see how or why.  XML Base merely provides a mechanism in XML
for how to embed the specification of a base URI in an XML resource
per RFC 2396 section 5.1.1. "Base URI within Document Content".  How
to use a base URI--whatever it is (except for how the base URI may
affect a relative xml:base specification)--is out of scope for XML Base,
as it is defined by RFC 2396.

paul

[1] http://www.w3.org/TR/WD-xml-fragment
[2] ftp://ftp.ietf.org/rfc/rfc2396.txt

Received on Thursday, 3 August 2000 10:25:28 UTC