Class: MD_Vouchers

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ MD_Vouchers

Returns a new instance of MD_Vouchers.



12
13
14
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb', line 12

def initialize(xml)
  @xml = xml
end

Instance Method Details

#writeXML(hVoucher) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb', line 16

def writeXML(hVoucher)

  # classes used in MD_Vouchers
  rPartyClass = CI_ResponsibleParty.new(@xml)

  @xml.tag!('gmd:MD_Vouchers') do

    # voucher - specimen - required
    s = hVoucher[:specimen]
    if s.nil?
      @xml.tag!('gmd:specimen',{'gco:nilReason'=>'missing'})
    else
      @xml.tag!('gmd:specimen') do
        @xml.tag!('gco:CharacterString',s)
      end
    end

    # voucher - repository - required - MD_ResponsibleParty
    hContacts = hVoucher[:repository]
    if hContacts.empty?
      @xml.tag!('gmd:reposit',{'gco:nilReason'=>'missing'})
    else
      @xml.tag!('gmd:reposit') do
        rPartyClass.writeXML(hContacts)
      end

    end

  end

end