Q: Using XML entities for href's

Richard Light richard at light.demon.co.uk
Mon Mar 2 17:09:39 GMT 1998


In message <199803021453.PAA28485 at sunfi1.fi.sdm.de>, Steffen Rodig
<rodig at sdm.de> writes
>In my xml based application I want to write xml documents with some
>kind of indirect links, since I don't know the exact location of a
>link target at the time a document is created and stored into a
>repository. I got the idea to use the entity concept of xml for doing
>this, since in my understanding entities can be used as virtual
>identifiers for physical locations. So at the time I request a
>document from the repository I'd like to include some entity
>definitions into the internal DTD of a document. Then it would
>look like this:
>
><?XML VERSION="1.0"?>
><!DOCTYPE CP-Document PUBLIC "-//SDM SHORE//DTD CP-Document//EN" [
><!ENTITY aRef SYSTEM "http://aServer/aDocument#anElement">
>]>
>...
><aTag xml-link=simple href=aRef>content</aTag>

There are two possible lines of attack suggested by XML itself (as
against XLL, which uses URLs as its targets without the need for an
entity declaration as in your example).

The PUBLIC identifier (of which you give an example above, in the
external entity declaration of your external DTD subset) is intended to
be a generic name which is not bound to a physical location.
Philosophically, this is exactly what you want.  

Unfortunately, in XML (unlike SGML) you can't just specify a PUBLIC
identifier - you have to give a system identifier as well.  (So, in
fact, your
><!DOCTYPE CP-Document PUBLIC "-//SDM SHORE//DTD CP-Document//EN" [
is not correct.)

Which brings us on to system identifiers, since you have to have one
anyway ;-)

The finalized XML Recommendation talks of these system identifiers being
a 'URI', as against a URL.  I remember a few years ago that URIs were
going to include URNs (Uniform Resource Names) as well as the URLs we
have grown to know and love.  URNs are (were?) like public identifiers
in not being closely-coupled to a physical storage location.  I think
that work is being done to update the definition of URIs to provide this
kind of flexibility.

Richard Light.

Richard Light
SGML/XML and Museum Information Consultancy
richard at light.demon.co.uk

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list