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');

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.

  • All elements with no explicit ID element remain anonymous, except

    • <topic> and

    • <association>

    elements which will get an ID assigned automatically.

INTERFACE

Constructor

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 (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

last_mod

returns the UNIX time when the resource has been modified last. undef is returned if the result cannot be determined.

sync_in

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

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.