class ADIWG::Mdtranslator::Writers::Iso19115_1::MD_AttributeGroup

Public Class Methods

new(xml, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attributeGroup.rb, line 18
def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
end

Public Instance Methods

writeXML(hGroup, inContext = nil) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attributeGroup.rb, line 24
def writeXML(hGroup, inContext = nil)

   # classes used
   codelistClass = MD_Codelist.new(@xml, @hResponseObj)
   attributeClass = Attribute.new(@xml, @hResponseObj)

   outContext = 'attribute group'
   outContext = inContext + ' attribute group' unless inContext.nil?

   unless hGroup.empty?
      @xml.tag!('mrc:MD_AttributeGroup') do

         # attribute group - content type [] {MD_CoverageContentTypeCode} (required)
         aContentTypes = hGroup[:attributeContentTypes]
         aContentTypes.each do |item|
            @xml.tag!('mrc:contentType') do
               codelistClass.writeXML('mrc', 'iso_coverageContentType', item)
            end
         end
         if aContentTypes.empty?
            @NameSpace.issueWarning(41, 'mrc:contentType', outContext)
         end

         # attribute group - attribute [] (abstract)
         aAttributes = hGroup[:attributes]
         aAttributes.each do |hAttribute|
            unless hAttribute.empty?
               @xml.tag!('mrc:attribute') do
                  attributeClass.writeXML(hAttribute, outContext)
               end
            end
         end
         if aAttributes.empty? && @hResponseObj[:writerShowTags]
            @xml.tag!('mrc:attribute')
         end

      end
   end

end