|
he
first part of XML specification
fully describes the syntax of the language. However, there's a
second
part of the specification that is concerned with linking
capabilities of XML documents similar to the hypertext features
of HTML.
In some sense, this is beyond the scope of an SGML-like language, as
the semantics of elements (including their capability to link)
should be left to creators of SGML or XML applications. On the other
hand, links are difficult to implement using common style sheet
languages and therefore need support from a deeper level. For this
reason (as well as, apparently, to make XML a better competition to
HTML), authors of the language chose to make linking provisions a part
of the main body of XML standard.
The linking model of XML (it can be used with SGML as well) is much
more versatile than that of HTML. It is largely based on the efforts
of other SGML projects such as HyTime and Text Encoding Initiative
(TEI). I don't describe the detailed syntax here, as it is likely to
change in subsequent drafts of the specification. It is worth noting,
however, that all linking constructs are implemented on the level of
reserved attributes and their values, not elements. This means that
you can easily turn any element into a link by expanding its list of
attributes.
A simple link intended to connect the XML document you're reading to
some other Internet resource may be assigned a number of parameters,
including the following:
- Strings describing the role of the link in the document
and its associated label (for example, this information
may be displayed by the browser in its status line);
- A parameter defining whether the linked resource should, upon
activating the link, replace the current document, be opened in
a new context (for example, in a new window), or be embedded
into the current document in place of the link;
- A parameter indicating whether the user may actuate the link or
it is activated automatically when encountered by the
processing application.
Very important, although perfectly backwards-compatible, enhancements
are proposed for the syntax of URLs that are used in XML to address
resources. Using search parts (separated by ?) or fragment
identifiers (separated by #) of special form, you can
access any part of another XML document without the necessity of
attaching a label to it beforehand (such as <A
NAME="..."> in HTML).
The syntax of such extended locators in XML is capable of
expressing formally such requests as "everything from the third
paragraph of the first chapter to the end of the chapter" or "the
whole section to which the last sidebar belongs." Of course "chapters"
or "sidebars" are to be declared as corresponding elements in the DTD
of the linked document.
Moreover, you may prescribe as to whether the necessary fragment is
extracted right on the server where the linked document is stored
(which may result in considerable bandwidth savings) or the server
sends you the whole document and it's your application that needs to
winkle out the part you requested.
XML links can be not only inline but also out-of-line, which
means that they do not need to reside in one of the documents
connected by the link. Links can be grouped so that all the links in a
group are activated at once. Finally, you can create collections of
interlinked documents and inform the processing application about what
other documents contain links to the current one.
|