class ADIWG::Mdtranslator::Writers::Iso19115_1::CI_Address

Public Class Methods

new(xml, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_address.rb, line 14
def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
end

Public Instance Methods

writeXML(hAddress) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_address.rb, line 19
def writeXML(hAddress)
   
   @xml.tag!('cit:CI_Address') do


      unless hAddress.nil?

         # address - address type (not used by ISO 19115-1)

         # address - description (not used by ISO 19115-1)

         # address - delivery points []
         aDeliveryPoints = hAddress[:deliveryPoints]
         aDeliveryPoints.each do |myPoint|
            @xml.tag!('cit:deliveryPoint') do
               @xml.tag!('gco:CharacterString', myPoint)
            end
         end
         if aDeliveryPoints.empty? && @hResponseObj[:writerShowTags]
            @xml.tag!('cit:deliveryPoint')
         end

         # address - city
         unless hAddress[:city].nil?
            @xml.tag!('cit:city') do
               @xml.tag!('gco:CharacterString', hAddress[:city])
            end
         end
         if hAddress[:city].nil? && @hResponseObj[:writerShowTags]
            @xml.tag!('cit:city')
         end

         # address - administrative area
         unless hAddress[:adminArea].nil?
            @xml.tag!('cit:administrativeArea') do
               @xml.tag!('gco:CharacterString', hAddress[:adminArea])
            end
         end
         if hAddress[:adminArea].nil? && @hResponseObj[:writerShowTags]
            @xml.tag!('cit:administrativeArea')
         end

         # address - postal code
         unless hAddress[:postalCode].nil?
            @xml.tag!('cit:postalCode') do
               @xml.tag!('gco:CharacterString', hAddress[:postalCode])
            end
         end
         if hAddress[:postalCode].nil? && @hResponseObj[:writerShowTags]
            @xml.tag!('cit:postalCode')
         end

         # address - country
         unless hAddress[:country].nil?
            @xml.tag!('cit:country') do
               @xml.tag!('gco:CharacterString', hAddress[:country])
            end
         end
         if hAddress[:country].nil? && @hResponseObj[:writerShowTags]
            @xml.tag!('cit:country')
         end

      end

   end # CI_Address tag
end