class ADIWG::Mdtranslator::Writers::Iso19115_2::MD_Vouchers

Public Class Methods

new(xml, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb, line 24
def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
end

Public Instance Methods

writeXML(hVoucher) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb, line 30
def writeXML(hVoucher)

   # classes used in MD_Vouchers
   partyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)

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

      # voucher - specimen (required)
      s = hVoucher[:specimen]
      if s.nil?
         @NameSpace.issueWarning(340, 'gmd:specimen')
      else
         @xml.tag!('gmd:specimen') do
            @xml.tag!('gco:CharacterString', s)
         end
      end

      # voucher - repository (required) {MD_ResponsibleParty}
      hRParty = hVoucher[:repository]
      if hRParty.empty?
         @NameSpace.issueWarning(341, 'gmd:specimen')
      else
         role = hRParty[:roleName]
         hParty = hRParty[:parties][0]
         @xml.tag!('gmd:reposit') do
            partyClass.writeXML(role, hParty, 'taxonomic voucher repository')
         end
      end

   end # gmd:MD_Vouchers tag
end