Class: MD_DatatypeCode

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/iso19115_2/codelists/code_datatype.rb

Overview

from www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml History: Stan Smith 2013-10-21 original script

Stan Smith 2014-10-15 allow non-ISO codesNames to be rendered

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ MD_DatatypeCode

Returns a new instance of MD_DatatypeCode.



9
10
11
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/codelists/code_datatype.rb', line 9

def initialize(xml)
  @xml = xml
end

Instance Method Details

#writeXML(codeName) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/codelists/code_datatype.rb', line 13

def writeXML(codeName)
  case(codeName)
    when 'class' then codeID = '001'
    when 'codelist' then codeID = '002'
    when 'enumeration' then codeID = '003'
    when 'codelistElement' then codeID = '004'
    when 'abstractClass' then codeID = '005'
    when 'aggregatedClass' then codeID = '006'
    when 'specifiedClass' then codeID = '007'
    when 'datatypeClass' then codeID = '008'
    when 'interfaceClass' then codeID = '009'
    when 'unionClass' then codeID = '010'
    when 'metaClass' then codeID = '011'
    when 'typeClass' then codeID = '012'
    when 'characterString' then codeID = '013'
    when 'integer' then codeID = '014'
    when 'association' then codeID = '015'
    else
      codeID = 'non-ISO codeName'
  end

  # write xml
  @xml.tag!('gmd:MD_DatatypeCode',{:codeList=>'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_DatatypeCode',
                     :codeListValue=>"#{codeName}",
                     :codeSpace=>"#{codeID}"})
end