Sha256: a7bd117e9f7540bb768e94c312a46f4763f5d57d5b054931495bc791d1b82932

Contents?: true

Size: 1.14 KB

Versions: 7

Compression:

Stored size: 1.14 KB

Contents

# ISO <<Class>> LI_Source
# writer output in XML

# History:
# 	Stan Smith 2013-11-20 original script
#   Stan Smith 2014-07-09 modify require statements to function in RubyGem structure

require 'class_citation'
require 'class_processStep'

class LI_Source

	def initialize(xml)
		@xml = xml
	end

	def writeXML(hSource)

		# classes used
		citationClass = CI_Citation.new(@xml)
		pStepClass = LI_ProcessStep.new(@xml)

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

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

			# source - citation
			hCitation = hSource[:sourceCitation]
			if !hCitation.empty?
				@xml.tag!('gmd:sourceCitation') do
					citationClass.writeXML(hCitation)
				end
			elsif $showAllTags
				@xml.tag!('gmd:sourceCitation')
			end

			# source - process steps
			aSteps = hSource[:sourceSteps]
			unless aSteps.empty?
				aSteps.each do |hStep|
					@xml.tag!('gmd:sourceStep') do
						pStepClass.writeXML(hStep)
					end
				end
			end

		end

	end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
adiwg-mdtranslator-0.10.2 lib/adiwg/mdtranslator/writers/iso/classes/class_source.rb
adiwg-mdtranslator-0.9.0 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb
adiwg-mdtranslator-0.8.6 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb
adiwg-mdtranslator-0.8.5 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb
adiwg-mdtranslator-0.8.2 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb
adiwg-mdtranslator-0.8.1 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb
adiwg-mdtranslator-0.8.0 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb