[topicmapmail] Embedding XTM Was: XTM Datatypes

Murray Altheim m.altheim@open.ac.uk
Mon, 09 Dec 2002 14:25:05 +0000


Anthony B. Coates wrote:

> ** Reply to message from Murray Altheim <m.altheim@open.ac.uk> on Fri, 06 Dec
> 2002 15:04:14 +0000
> 
>>I agree that it's relatively simple to extract <topicMap> elements
>>from a larger document, and have no problem with this even though
>>I still would have preferred it not have been allowed. But to
>>allow other content within the topic map itself would essentially
>>mean XTM was no longer XTM, but some mix of namespaces, hardly
>>an interchange any longer but a way for companies to use features
>>in competition as did Microsoft and Netscape. This did nobody any
>>good in the end. It didn't create innovation, only balkanization.
> 
> I think there is a clear issue here of having one format being pressured to
> satisfy two needs.  The original goal of XTM appears to have been to create a
> simple interchange syntax for topic maps, one which could include references to
> other documents via URIs.  However, I am one of the many potential users who
> would like to be able to embed XTM within XML documents and link to non-XTM
> items within those documents.  So, I guess what I really want is an embeddable
> *variant* of XTM, one with guidelines telling people what the rules for
> embedded use are.


I don't see any "clear issue" at all. XTM is easily able to fulfill
these requirements without creating any variant. It is embeddable,
and as I'll show below, there's no need for guidelines other than
those already provided by existing XML standards and tools such as
DOM and XML itself (such as rules for ID namespaces, addressing, etc.).


> Murray has made the point that it is not hard to extract a valid XTM document
> from such a mixed document.  What would be very useful is a formal process for
> this, so that there was a well understood way that such an extracted XTM
> document would refer back to the general XML content in its original mixed
> source document.  If we could get to this, it would allow people to create
> small all-in-one documents with embedded topic map elements, without making
> life impossible for XTM engines trying to import the information from these
> documents.
> 
> Sound plausible?


Plausible insofar as it's simple to perform. As Eliot has said,

there's no reason to standardize this since everything you
need to perform this is already available, there are no specific
needs that aren't already met by available tools, there are no
additional issues regarding addressing internal and external to
the topic map document, i.e., no necessity for changes to XTM.

The complete Java/DOM code necessary to perform this is as below:


    /** A method to extract topic map elements from a DOM 
      * Document, returning an Iterator over the available
      * Elements, null if none are found.

      */
    public Iterator getTopicMaps( Document doc )
    {
        NodeList maps = doc.getElementsByTagNameNS(
                "http://www.topicmaps.org/xtm/1.0/","topicMap");
        ArrayList list = new ArrayList();
        for ( int i = 0; i < maps.getLength(); i++ ) {
            list.add(maps.itemAt(i));
        }
        if ( list.size() == 0 ) return null;
        return list.iterator();
    }

As you can see, there's little need for standardization of this.


Referring back to the original content is done by simply addressing

via existing schemes the original content of the Document -- it
hasn't been corrupted.

Murray

......................................................................
Murray Altheim                  <http://kmi.open.ac.uk/people/murray/>
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK

            If you're the first person in a new territory,
            you're likely to get shot at.
                                                     -- ma