Reference

XTM::XML(3pm)

XTM::XML - Topic Map management, syncing with XML data

  use XTM::XML;
  # reading a topic map description from an XML file
  $xml = new XTM::XML (file => 'mymap.tm');
  $tm = $xml->sync_in();

This package provides interfacing with external resources based on XTM (XML Topic Map) format as described in

   http://www.topicmaps.org/xtm/1.0/

except that it ignores all merging related constraints (TNC) given in
http://www.topicmaps.org/xtm/1.0/#processing it only allows ONE SINGLE <topicMap> element in a document violating '4.4 XTM Document Conformance', item 2. The reasoning for this is that loading multiple maps implicitely means that some merging has to occur. This should NOT be happening implicitly. All elements with no explicit ID element remain anonymous, except <topic> and <association>

elements which will get an ID assigned automatically if none is provided in the XTM instance.
Constructor $xmlhandle = new XTM::XML (url_file_or_text => $source,
[ auto_complete => 1_or_0 ]) The constructor expects a hash as parameter containing one of the following fields: If given then the XML data will be read/written from/to this url. If given then the XML data will be read/written from/to this file (This is just a convenience function as it will be mapped to url). If given then the XML data will be read/written from/to this text. (See method text how to retrieve the current value). If set to 0, the XTM loader will NOT try to automatically generate topics which have been mentioned without being declared. If several fields ("file", "url", "text") are specified, it is undefined which one will be taken. Examples:

   $xtm = new XTM::XML (file => 'here.xml');
   $xtm = new XTM::XML (url  => 'file:here.xml',  # the same
                        auto_complete => 0);      # but with auto_completion turned off
   $xtm = new XTM::XML (text => '<?xml version="1.0"?><topicMap> ...</topicMap>');

Methods The methods "sync_in", "sync_out" and "last_mod" implement the methods from the abstract class XTM::IO $unix_time = $xmlhandle->last_mod

returns the UNIX time when the resource has been modified last. "undef" is returned if the result cannot be determined. $xmlhandle->sync_in ([ $consistency ]);

actually loads an XTM resource and returns a XTM::Memory object.

The optional parameter specifies the consistency (as defined in XTM) with which the map will be built. The default consistency will be used if the parameter is missing. $xmlhandle->sync_out

is currently not implemented. XTM Copyright 2002, Robert Barta <[email protected]>, All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. http://www.perl.com/perl/misc/Artistic.html

History