man XTM::XML () - Topic Map management, syncing with XML data

NAME

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

SYNOPSIS

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

DESCRIPTION

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.

INTERFACE

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:

url:
If given then the XML data will be read/written from/to this url.
file:
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).
text:
If given then the XML data will be read/written from/to this text. (See method text how to retrieve the current value).
auto_complete
If set to 0, the XTM loader will NOT try to automatically generate topics which have been mentioned without being declared.

If several fields (CWfile, CWurl, CWtext) 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 CWsync_in, CWsync_out and CWlast_mod implement the methods from the abstract class XTM::IO

last_mod
$unix_time = $xmlhandle->last_mod returns the UNIX time when the resource has been modified last. CWundef is returned if the result cannot be determined.
sync_in
$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.
sync_out
$xmlhandle->sync_out is currently not implemented.

SEE ALSO

XTM

AUTHOR INFORMATION

Copyright 2002, Robert Barta <rho@telecoma.net>, 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