XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Xlink Isn't Dead

Michael Kay wrote:
>>         If a styling language were able to say "this is a 
>>link" and "that attribute is the link address" and other such 
>>goodness, what else would be needed in core XML?
> 
> 
> Look at what we've got:
> 
> parent/child relationships: fine so long as the data is hierarchic
> 
> ID/IDREF, with strange lexical rules on the form of an identifier, with no
> ability to have more than one domain of identifiers in the same document,
> with no ability to say what kind of thing an IDREF is supposed to identify,
> and which is confined in scope to a single document.
> 
> key/keyref in XML Schema, which removes many of the constraints of ID/IDREF
> but which is still, crucially, confined to intra-document relationships (and
> whose specification is incomprehensible to mortals)
> 
> URIs, which mean anything you want them to mean: a semantic-free zone, but
> one with ugly syntactic constraints
> 
> RDF, which is impractical for most applications and bears very little
> relationship to XML.
> 
> What's needed is a mechanism for declaring and maintaining non-hierarchic
> relationships between objects (elements) that allows:
> 
> * freedom of choice in the syntactic form of the identifier
> 
> * freedom of choice in the naming of identifiers 
> 
> * independence of document boundaries
> 
> * indirection between identifiers of objects and the addresses of the
> documents containing them 
> 
> * indirection between identifiers of objects and their XML representations
> 
> * bi-directional (inverse) relationships
> 
> * flexibility in the management of referential integrity
> 
> * versioning
> 
> etc.
> 
> Michael Kay
> http://www.saxonica.com/
> 

I have experimented for my own documents a kind of links based on QNames

As usual, these links are in the source documents and have to be 
published in a way understandable by the target device (for a web 
browser, it will be an URL). I never localize my documents, I always 
name them ; URNs seem to be good candidates (this is the indirection 
layer Michael is talking about).

The idea is to specify a link to an identifier of a document thanks to a 
QName where the namespace URI is the URN of the target document, and the 
local name is an identifier within the target document :

<document xmlns:foo="urn:acme:the-doc-1">
     <link target="foo:bar"/>
</document>

By defining the namespace binding at the root element, the prefixes can 
be used at several places inside the document, this is the rules of XML 
namespaces. It is certainly usefull to define systematically a namespace 
binding for the current document, bound to a convenient prefix :

==== urn:acme:the-doc-2 ====
<document
   xmlns:foo="urn:acme:the-doc-1"
   xmlns:this="urn:acme:the-doc-2">
     <link target="foo:bar"/>
     <link target="this:part"/>
     ...
     <anchor id="this:part"/>
</document>

==== urn:acme:the-doc-1 ====
<anotherdoc
   xmlns:this="urn:acme:the-doc-1"
   xmlns:doc2="urn:acme:the-doc-2">
     <link target="doc2:part"/>
</anotherdoc>

To specify the entire document use simply : <link target="doc2"/>

Of course, <link> or @target and <anchor> or @id should themselves be 
bound to a namespace URI, like XLink does for its attributes, so that 
the semantic of these things can be interpreted by the applications.

This approach has a great advantage : when my programs cut and paste a 
part of a document that contains a link, it also copy the namespace 
binding ; when necessary, the prefix are renamed. After the operation, 
the links in the new document are preserved (the target is still the same).
The drawback is that each of my documents must define dozens of xmlns 
declarations... I also know there are some other issues.

-- 
Cordialement,

               ///
              (. .)
  --------ooO--(_)--Ooo--------
|      Philippe Poulard       |
  -----------------------------
  http://reflex.gforge.inria.fr/
        Have the RefleX !


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS