René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
XLink | ||
Generally speaking, a link relates two (or more) resources. Those resources can be in virtually any format: an XML document, a music file, a picture,
a query result or what ever you care to link to.
XLinks works on locations, not on resources.
Links provide the following conviniences:
Problems with (traditional) HTML links
TerminologyLink
A link is a (explicitely stated) relationship between two (or more) locations.
The link is said to be
Linking element
An XML Element that describes a link.
Locator
A locator identifies a remote resource participating in a link.
A setup for a XLink element
For an element to be an XLink, it must use the XLink namespace. The following
fragment turns some_element into a source of a link.
<some_element xmlns:xlink="http://www.w3.org/1999/xlink .... .... > </some_element>
The following code is a complete, although small, example for an XML docment with a
DTD that contains an XLink.
<?xml version="1.0" ?> <!DOCTYPE Author [ <!ELEMENT Author EMPTY > <!ATTLIST Author xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink" xlink:type (simple|extended|locator|arc|resource|title|none) #REQUIRED xlink:href CDATA #REQUIRED xlink:role CDATA #IMPLIED xlink:title CDATA #IMPLIED xlink:show (new|embedded|replace) "replace" xlink:actuate (onLoad|onRequest) "onRequest" > ] > <Author xmlns:xlink = "http://www.w3.org/1999/xlink" xlink:type = "simple" xlink:href = "somebody.xml" xlink:role = "author" xlink:title = "author" xlink:show = "replace" xlink:actuate = "onRequest" /> Valid XLinks
An XML element is an XLink if
Although the type attribute indicates there are a few types of XLinks, this is not true, there are only simple links and
extended links. Simple links are functionally equivalent to HTML hyperlinks.
Typessimple
A link is simple if its attribute type is set to "simple".
A simple element is outbound.
extended
A link is simple if its attribute type is set to "extended".
locator
A locator is only possible within extended links. There is a lcoator for each resource that participates in an extended link.
Can have title as child.
href is a mandatory attribute.
role, title and href are equivalent to their use for simple links.
href is also called the locator attribute.
Note: a locator does not necesseraly point to a target. It points to a resource that is involved in linking. In order to establish a connection,
arc is needed.
arc
Defines a traversal rule between any combination of two locators and resources.
Can have arc as child.
resource
The resource type indicates a local resource (as opposed to the locator type).
titlenoneAttributes in an XLink Elementrole
Content not specified by w3c (?), indicates the role (nature) of the link. It must be uri reference.
arcrole
Content not specified by w3c (?). It must be uri reference.
title
A link describing string for the user.
How the title is used in a XLink Application is not defined.
href
The target of the link.
show
How the target is rendered. Possible values:
actuate
Defines when the link is executed. Possible values:
type
Can be either
fromtolabelWeird combinations
A combination of xlink:show="replace" and xlink;actuate="onLoad" makes limited sense. It could
be interpreted as a redirection. However, what happens if two such combinations are present in a document?
Extended links
Extended Links allow to combine multiple resources.
Third party link<lnk xmlns:xlink = "http://www.w3.org/1999/xlink" xlink:type = "extended"> <res xlink:type = "locator" xlink:href="foo.bar" xlink:label= "fromHere" /> <res xlink:type = "locator" xlink:href="foo.bar" xlink:label= "toThere" /> <arc xlink:type= "arc" xlink:from="fromHere" xlink:to="toThere" /> </lnk> XLink Application
An XLink Application interprets well formed XML document with XLink elements and attributes.
LinksMisc
A type=resource identifies a local resource while a locator defines a remote resource. This can be a bit missleading.
|