Before they can actually be used, relative URIs must be resolved into absolute URIs. A "base" URI is added as the initial portion of the absolute URI. Thus a URI such as website/images/picture.jpg if it appears in an HTML Web page fetched from https://foo.example.com/projects/ would be interpreted as https://foo.example.com/projects/website/images/picture.jpg This base information can be obtained from four sources [RFC 2396]:
Lower-numbered sources in this list dominate higher-numbered ones. XML security does not use Source 4 . Sources 2 and 3 are sometimes the same, but one URI might retrieve an enclosing object while the relative URI occurs within a nested object that has a different, possibly more specific URI. To set embedded base URI information, you can use "xml:base". As Source 1 in the list, it dominates all other base URI sources. In particular, xml:base occurs as an attribute and sets the URI base at that node and all descendant nodes until it reaches one that overrides it. The XML in Example 7-1 produces the effective absolute URIs shown in Table 7-1. While this example uses "href", other attributes can have a URI in their value; likewise, URIs can be present in text content and processing instructions. Example 7-1 Base, relative, and absolute URIs<foo xml:base="https://example.com/1/"> <bar href="data.jpg" /> <bar href="image.gif" xml:base="ftp://10.0.0.1/"> <charlie href="delta/description.txt" /> <charlie href="http://xyz.example/cgi/" /> </bar> <bar href="http://2/3/" /> </foo> You determine base URIs as follows:
|