Module: RTM::AR::IO::FROMXTM2LX
- Defined in:
- lib/rtm/activerecord/io/from_xtm2_libxml.rb
Overview
XTM2 Export. Each Topic Maps Construct gets a to_xtm2 method. The result is a REXML::Element except for TopicMap where it is a REXML::Document.
Constant Summary collapse
- XTM2DEBUG =
false
Class Method Summary collapse
-
.from_xtm2(base_tms, source, base_locator, target = nil, options = {}) ⇒ Object
Reads XTM2 from source (io object).
Class Method Details
.from_xtm2(base_tms, source, base_locator, target = nil, options = {}) ⇒ Object
Reads XTM2 from source (io object). Example: RTM::IO::FROMXTM2.from_xtm2(File.open(file_name),“rtm.rubyforge.org/topicmaps/tm1/”) supported options: :strip_whitespace (defaults to false, may be set to true), :deprefix (defaults to nil, may be set to a string (or regex) which will be removed from the beginning of an (unresolved) item_identifier if it is there.
27 28 29 30 31 32 33 34 |
# File 'lib/rtm/activerecord/io/from_xtm2_libxml.rb', line 27 def self.from_xtm2(base_tms, source, base_locator, target=nil,={}) tm = base_tms.create(base_locator) unless target parser = XML::SaxParser.new parser.callbacks = XML::LibXMLSax2wrapper.new(FROMXTM2::XTM2Listener.new(base_locator, target || tm, )) parser.filename = source parser.parse #true end |