Local Resources
Locators represent remote resources; that is, resources that
are not part of the document that contains the extended link.
Extended links can also contain local resources in which the data is
contained inside the extended link element. Each such resource is
represented by a resource element , which is an element of arbitrary type that has
an xlink:type
attribute with the value resource
. For instance, in Example 10-1, the series
extended link element contains an
author
child element. This can be
made a local resource simply by giving it an xlink:type="resource
" attribute:
<author xlink:type="resource">L. Frank Baum</author>
A resource element can and generally does have the same
attributes as a locator element; that is, xlink:label
, xlink:role
, and xlink:title
. These all have the same semantics as they do for
locator elements. For instance, the label is a name that arcs use to
connect resources. An arc can connect a resource to a resource, a
resource to a locator, a locator to a resource, or a locator to a
locator. Arcs really don’t care whether resources are local or
remote. To link to or from this resource, an arc needs an xlink:label
attribute, like this:
<author xlink:type="resource" xlink:label="baum">L. Frank Baum</author>
To establish links from this local resource to all the books, we’d simply add these three arc elements:
<book xlink:type="arc" xlink:from="baum" xlink:to="oz1" /> <book xlink:type="arc" xlink:from="baum" xlink:to="oz2" /> <book xlink:type="arc" ...
Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.