class ADIWG::Mdtranslator::Writers::Fgdc::TaxonomyKeyword

Public Class Methods

new(xml, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb, line 17
def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
end

Public Instance Methods

writeXML(aKeywords) click to toggle source
# File lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb, line 23
def writeXML(aKeywords)

   # taxonomy bio (keywtax) - taxonomic keywords (required)
   haveTaxKeyword = false
   aKeywords.each do |hKeySet|
      type = hKeySet[:keywordType]
      if type == 'taxon'
         haveTaxKeyword = true
         @xml.tag!('keywtax') do
            aKeywords = hKeySet[:keywords]
            thesaurus = hKeySet[:thesaurus]
            unless thesaurus.empty?
               @xml.tag!('taxonkt', thesaurus[:title])
            end
            if thesaurus.empty?
               @NameSpace.issueWarning(420, 'taxonkt')
            end
            aKeywords.each do |hKeyword|
               keyword = hKeyword[:keyword]
               unless keyword.nil?
                  @xml.tag!('taxonkey', keyword)
               end
            end
            if aKeywords.empty?
               @NameSpace.issueWarning(421, 'taxonkey')
            end
         end
      end
   end
   unless haveTaxKeyword
      @NameSpace.issueWarning(422)
   end

end