Is a fragment ID a URI reference?

Discussion in 'XML' started by Gustaf, May 18, 2006.

  1. Gustaf

    Gustaf Guest

    I'm trying to grasp this little passage from the XBRL spec:

    "The xlink:href attribute MUST be a URI. The URI MUST point to an XML
    document or to one or more XML fragments within an XML document. If the
    URI is relative, it MUST be resolved to obtain an absolute URI as
    specified in XML Base specification [XML Base]."

    I guess they really mean "URI reference" and not "URI" in the formal
    sense. But anyway, consider this document:

    <?xml version="1.0"?>
    <a xml:base="http://example.org/schema.xsd"
    xmlns:xlink="http://www.w3.org/1999/xlink">
    <b xlink:href="#myelement"/>
    </a>

    My question is: is a fragment ID by itself a URI reference? Is the above
    example valid, or can xlink:href="#myelement" only refer to the same
    document?

    Gustaf
     
    Gustaf, May 18, 2006
    #1
    1. Advertising

  2. * Gustaf wrote in comp.text.xml:
    ><a xml:base="http://example.org/schema.xsd"
    > xmlns:xlink="http://www.w3.org/1999/xlink">
    > <b xlink:href="#myelement"/>
    ></a>
    >
    >My question is: is a fragment ID by itself a URI reference? Is the above
    >example valid, or can xlink:href="#myelement" only refer to the same
    >document?


    It's valid and refers to (#myelement in) the same document, please see
    RFC 3986 for details.
    --
    Björn Höhrmann · mailto: · http://bjoern.hoehrmann.de
    Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
    68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
     
    Bjoern Hoehrmann, May 18, 2006
    #2
    1. Advertising

  3. In article <>,
    Gustaf <> wrote:
    >My question is: is a fragment ID by itself a URI reference? Is the above
    >example valid, or can xlink:href="#myelement" only refer to the same
    >document?


    A URI reference of the form #myelement is always a same-document
    reference, regardless of the base URI.

    Either by RFC 2396, in which it is handled explicitly without
    reference to the base URI:

    4.2. Same-document References

    A URI reference that does not contain a URI is a reference to the
    current document. In other words, an empty URI reference within a
    document is interpreted as a reference to the start of that document,
    and a reference containing only a fragment identifier is a reference
    to the identified fragment of that document.

    or by RFC 3986, in which it is handled by using the base URI and comparing
    it with the (same!) base URI:

    4.4. Same-Document Reference

    When a URI reference 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.

    You can't use xml:base to make a bare fragment refer to some other document.

    -- Richard
     
    Richard Tobin, May 18, 2006
    #3
  4. Gustaf

    Gustaf Guest

    Richard Tobin wrote:

    > A URI reference of the form #myelement is always a same-document
    > reference, regardless of the base URI.


    A good answer. It simplifies my task too. :)

    Gustaf
     
    Gustaf, May 18, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Harris
    Replies:
    0
    Views:
    6,381
    Simon Harris
    May 10, 2005
  2. Stanimir Stamenkov
    Replies:
    1
    Views:
    2,474
    Stanimir Stamenkov
    Aug 17, 2005
  3. Pavel
    Replies:
    2
    Views:
    1,651
    Peter Flynn
    Aug 4, 2004
  4. etheriau
    Replies:
    1
    Views:
    667
    Pavel
    Aug 23, 2004
  5. Joe Curry

    Invalid URI: The format of the URI could not be determined.

    Joe Curry, Oct 8, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    343
    Joe Curry
    Oct 8, 2003
Loading...

Share This Page