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 an abstract class to deal with TMs stored in XML form, be it on files or as a string. The package honors

http://www.topicmaps.org/xtm/1.0/xtm1-20010302-2.html

except

- ignores all merging related constraints (TNC) given in

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

- only allows ONE SINGLE <topicMap> element in a document violating
  '4.4 XTM Document Conformance', item 2

All elements with no explicit ID element remain anonymous, execept

- <topic> and
- <association>

elements which will get an ID assigned.

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).

If several fields are specified, an exception will be raised.

Examples:

$xtm = new XTM::XML (file => 'here.xml');
$xtm = new XTM::XML (url  => 'file:here.xml');  # the same
$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.

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 2001, 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.