Module: RTM::AR::IO::FROMXTM2
- Defined in:
- lib/rtm/activerecord/io/from_xtm2.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.
Defined Under Namespace
Classes: XTM2Listener
Constant Summary collapse
- XTM2DEBUG =
require ‘jrexml’
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.rb', line 27 def self.from_xtm2(base_tms, source, base_locator, target=nil,={}) tm = base_tms.create(base_locator) unless target list = XTM2Listener.new(base_locator, target || tm, ) parser = REXML::Parsers::SAX2Parser.new(source) parser.listen(list) parser.parse true end |