How will XML affect my document links?
The linking abilities of XML systems are potentially
much more powerful than those of HTML, so you'll be able
to do much more with them. Existing href-style links
will remain usable, but the new linking technology is
based on the lessons learned in the development of other
standards involving hypertext, such as TEI and HyTime,
which let you manage bidirectional and multi-way links,
as well as links to a whole element or span of text
(within your own or other documents) rather than to a
single point. These features have been available to SGML
users for many years, so there is considerable
experience and expertise available in using them.
Currently only Mozilla Firefox implements XLink.
The XML Linking Specification (XLink) and the XML
Extended Pointer Specification (XPointer) documents
contain the details. An XLink can be either a URI or a
TEI-style Extended Pointer (XPointer), or both. A URI on
its own is assumed to be a resource; if an XPointer
follows it, it is assumed to be a sub-resource of that
URI; an XPointer on its own is assumed to apply to the
current document (all exactly as with HTML).
An XLink may use one of #, ?, or |. The # and ? mean the
same as in HTML applications; the | means the
sub-resource can be found by applying the link to the
resource, but the method of doing this is left to the
application. An XPointer can only follow a #.
The TEI Extended Pointer Notation (EPN) is much more
powerful than the fragment address on the end of some
URIs, as it allows you to specify the location of a link
end using the structure of the document as well as (or
in addition to) known, fixed points like IDs. For
example, the linked second occurrence of the word
‘XPointer’ two paragraphs back could be referred to with
the URI (shown here with linebreaks and spaces for
clarity: in practice it would of course be all one long
This means the first link element within the second
paragraph within the answer in the element whose ID is
hypertext (this question). Count the objects from the
start of this question (which has the ID hypertext) in
the XML source:
1. the first child object is the element containing the
2. the second child object is the answer (the element);
3. within this element go to the second paragraph;
4. find the first link element.
Eve Maler explained the relationship of XLink and
XPointer as follows:
XLink governs how you insert links into your XML
document, where the link might point to anything (eg a
GIF file); XPointer governs the fragment identifier that
can go on a URL when you're linking to an XML document,
from anywhere (eg from an HTML file).
[Or indeed from an XML file, a URI in a mail message,
David Megginson has produced an xpointer function for
Emacs/psgml which will deduce an XPointer for any
location in an XML document. XML Spy has a similar
How does XML handle metadata?
Because XML lets you define your own markup languages,
you can make full use of the extended hypertext features
of XML (see the question on Links) to store or link to
metadata in any format (eg using ISO 11179, as a Topic
Maps Published Subject, with Dublin Core, Warwick
Framework, or with Resource Description Framework (RDF),
or even Platform for Internet Content Selection (PICS)).
There are no predefined elements in XML, because it is
an architecture, not an application, so it is not part
of XML's job to specify how or if authors should or
should not implement metadata. You are therefore free to
use any suitable method. Browser makers may also have
their own architectural recommendations or methods to
This will depend on what facilities your users' browsers
implement. XML is about describing information;
scripting languages and languages for embedded
functionality are software which enables the information
to be manipulated at the user's end, so these languages
do not normally have any place in an XML file itself,
but in stylesheets like XSL and CSS where they can be
added to generated HTML.
XML itself provides a way to define the markup needed to
implement scripting languages: as a neutral standard it
neither encourages not discourages their use, and does
not favour one language over another, so it is possible
to use XML markup to store the program code, from where
it can be retrieved by (for example) XSLT and
re-expressed in a HTML script element.
Server-side script embedding, like PHP or ASP, can be
used with the relevant server to modify the XML code on
the fly, as the document is served, just as they can
with HTML. Authors should be aware, however, that
embedding server-side scripting may mean the file as
stored is not valid XML: it only becomes valid when
processed and served, so care must be taken when using
validating editors or other software to handle or manage
such files. A better solution may be to use an XML
serving solution like Cocoon, AxKit, or PropelX.
Can I use Java to create or manage XML files?
Yes, any programming language can be used to output data
from any source in XML format. There is a growing number
of front-ends and back-ends for programming environments
and data management environments to automate this. Java
is just the most popular one at the moment.
There is a large body of middleware (APIs) written in
Java and other languages for managing data either in XML
or with XML input or output.
How do I execute or run an XML file?
You can't and you don't. XML itself is not a programming
language, so XML files don't ‘run’ or ‘execute’. XML is
a markup specification language and XML files are just
data: they sit there until you run a program which
displays them (like a browser) or does some work with
them (like a converter which writes the data in another
format, or a database which reads the data), or modifies
them (like an editor).
If you want to view or display an XML file, open it with
an XML editor or an question B.3, XML browser.
The water is muddied by XSL (both XSLT and XSL:FO) which
use XML syntax to implement a declarative programming
language. In these cases it is arguable that you can
‘execute’ XML code, by running a processing application
like Saxon, which compiles the directives specified in
XSLT files into Java bytecode to process XML.
How do I control formatting and appearance?
In HTML, default styling was built into the browsers
because the tagset of HTML was predefined and hardwired
into browsers. In XML, where you can define your own
tagset, browsers cannot possibly be expected to guess or
know in advance what names you are going to use and what
they will mean, so you need a stylesheet if you want to
display formatted text.
Browsers which read XML will accept and use a CSS
stylesheet at a minimum, but you can also use the more
powerful XSLT stylesheet language to transform your XML
into HTML—which browsers, of course, already know how to
display (and that HTML can still use a CSS stylesheet).
This way you get all the document management benefits of
using XML, but you don't have to worry about your
readers needing XML smarts in their browsers.