Module: RTM::IO::TOXTM1

Defined in:
rtm/lib/rtm/io/to_xtm1.rb

Overview

XTM1 Export

Defined Under Namespace

Modules: Association, Name, Occurrence, Role, Topic, TopicMap, Variant

Class Method Summary

Class Method Details

+ (Object) locator(loc, tagname = "itemIdentity")



31
32
33
34
35
# File 'rtm/lib/rtm/io/to_xtm1.rb', line 31

def self.locator(loc, tagname = "itemIdentity")
  x = REXML::Element.new(tagname)
  x.add_attribute('href',loc.to_s) # loc could be Locator or String, to_s serves both
  x
end

+ (Object) scope(scope)



8
9
10
11
12
13
14
# File 'rtm/lib/rtm/io/to_xtm1.rb', line 8

def self.scope(scope)
  res = REXML::Element.new('scope')
  scope.each do |s|
    res << s.to_xtm_ref
  end
  res
end

+ (Object) type(type)



15
16
17
18
19
# File 'rtm/lib/rtm/io/to_xtm1.rb', line 15

def self.type(type)
  res = REXML::Element.new('type')
  res << type.to_xtm_ref
  res
end

+ (Object) value(datatype, value)



20
21
22
23
24
25
26
27
28
29
30
# File 'rtm/lib/rtm/io/to_xtm1.rb', line 20

def self.value(datatype, value)
  if datatype == RTM::PSI[:IRI]
    res = REXML::Element.new 'resourceRef'
    res.add_attribute('href', value)
  else
    res = REXML::Element.new 'resourceData'
    res.add_attribute('datatype', datatype) if datatype
    res.text = value
  end
  res
end