Linking XML documents

[Update: help is on the way.] If you start with an XML document online (and granted, there are precious few of them), how do you use it to find other XML documents? If they’re XML+XHTML documents, you can follow the URLs in any xhtml:a/@href attributes you find in the document; if they’re XML+RDF documents, you can follow the @rdf:about and @rdf:resource attributes; if they’re XML+Docbook documents, you can follow the ulink/@url attributes; and so on.

But what about plain old XML? The best candidate seems to be XLink. While the specification is excessively complicated, it does offer the global xlink:href attribute as a simple linking attribute that any type of XML document can use: some document types, like XML Topic Maps, have taken full advantage of it.

Unfortunately, there is no conformant way to use just xlink:href in an XML document; every time it appears, you also need to have the xlink:type attribute set to the value “simple“. Oops! XTM gets around that by declaring the attribute with a #FIXED value in its DTD, so that it does not have to be repeated in the document itself, but we can hardly require every XML document online to use a DTD or schema, and if they don’t include xlink:type, they’re not conformant. So we cannot simply have

<musician xlink:href=""/>
<musician xlink:href=""/>
<musician xlink:href=""/>

but rather, we are forced to use

<musician xlink:type="simple" xlink:href=""/>
<musician xlink:type="simple" xlink:href=""/>
<musician xlink:type="simple" xlink:href=""/>

That gets extremely annoying after a few hundred times, probably enough to prevent it from getting universal acceptance. So what do we do? Is there any way to cheat and say something like all XML documents that do not have a DTD are assumed to have an implied DTD with a fixed declaration of xlink:type for every element? I don’t think so. The XLink recommendation was written by some of the brightest people in XML, and I’m sure that they didn’t intend for it to be so awkward for the simplest (and most common) case. It would be wonderful if the W3C could put out some kind of corrigendum stating that when xlink:type is missing, it defaults to “simple“. That’s all we need. Really.

[Update: I forgot to mention that the W3C’s XML Linking working group no longer exists to make any changes to the spec.]

[Update: it turns out that the XML Core WG is working on this very issue: two days after my original posting, entirely by coincidence, Norm Walsh posted that xlink:type will likely become optional.]

About David Megginson

Scholar, tech guy, Canuck, open-source/data/information zealot, urban pedestrian, language geek, tea drinker, pater familias, red tory, amateur musician, private pilot.
This entry was posted in General. Bookmark the permalink.

2 Responses to Linking XML documents

  1. Pingback: Links for XML <Anne's Weblog about Markup & Style>

  2. Pingback: Jim Fuller's Ruminations

Comments are closed.