Class: DarwinCore::Generator::MetaXml

Inherits:
Object
  • Object
show all
Defined in:
lib/dwc_archive/generator_meta_xml.rb

Overview

Creates DarwinCore meta file

Instance Method Summary collapse

Constructor Details

#initialize(data, path) ⇒ MetaXml

Returns a new instance of MetaXml.


5
6
7
8
9
# File 'lib/dwc_archive/generator_meta_xml.rb', line 5

def initialize(data, path)
  @data = data
  @path = path
  @write = "w:utf-8"
end

Instance Method Details

#createObject


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dwc_archive/generator_meta_xml.rb', line 11

def create
  schema_uri = "http://rs.tdwg.org/dwc/terms/xsd/archive/ "\
    "http://darwincore.googlecode.com/svn/trunk/text/tdwg_dwc_text.xsd"
  builder = Nokogiri::XML::Builder.new do |xml|
    opts = { encoding: "UTF-8", fieldsTerminatedBy: ",",
             fieldsEnclosedBy: '"', linesTerminatedBy: "\n",
             rowType: "http://rs.tdwg.org/dwc/terms/Taxon" }
    build_archive(xml, opts, schema_uri)
  end
  save_meta(builder)
end