lib/adiwg/mdtranslator/writers/iso/classes/class_dataQuality.rb in adiwg-mdtranslator-0.10.2 vs lib/adiwg/mdtranslator/writers/iso/classes/class_dataQuality.rb in adiwg-mdtranslator-0.12.0
- old
+ new
@@ -2,54 +2,66 @@
# 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
+# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
+# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
require 'code_scope'
require 'class_lineage'
-class DQ_DataQuality
+module ADIWG
+ module Mdtranslator
+ module Writers
+ module Iso
- def initialize(xml)
- @xml = xml
- end
+ class DQ_DataQuality
- def writeXML(hDataQ)
+ def initialize(xml)
+ @xml = xml
+ end
- # classes used
- scopeCode = MD_ScopeCode.new(@xml)
- lineClass = LI_Lineage.new(@xml)
+ def writeXML(hDataQ)
- @xml.tag!('gmd:DQ_DataQuality') do
+ # classes used
+ scopeCode = $WriterNS::MD_ScopeCode.new(@xml)
+ lineClass = $WriterNS::LI_Lineage.new(@xml)
- # data quality - scope - required
- s = hDataQ[:dataScope]
- if s.nil?
- @xml.tag!('gmd:scope',{'gco:nilReason'=>'missing'})
- else
- @xml.tag!('gmd:scope') do
- @xml.tag!('gmd:DQ_Scope') do
- @xml.tag!('gmd:level') do
- scopeCode.writeXML(s)
- end
- end
- end
- end
+ @xml.tag!('gmd:DQ_DataQuality') do
- # date quality - report
+ # data quality - scope - required
+ s = hDataQ[:dataScope]
+ if s.nil?
+ @xml.tag!('gmd:scope', {'gco:nilReason' => 'missing'})
+ else
+ @xml.tag!('gmd:scope') do
+ @xml.tag!('gmd:DQ_Scope') do
+ @xml.tag!('gmd:level') do
+ scopeCode.writeXML(s)
+ end
+ end
+ end
+ end
- # data quality - lineage
- hLineage = hDataQ[:dataLineage]
- if !hLineage.empty?
- @xml.tag!('gmd:lineage') do
- lineClass.writeXML(hLineage)
- end
- elsif $showAllTags
- @xml.tag!('gmd:lineage')
- end
+ # date quality - report
- end
+ # data quality - lineage
+ hLineage = hDataQ[:dataLineage]
+ if !hLineage.empty?
+ @xml.tag!('gmd:lineage') do
+ lineClass.writeXML(hLineage)
+ end
+ elsif $showAllTags
+ @xml.tag!('gmd:lineage')
+ end
- end
+ end
+ end
+
+ end
+
+ end
+ end
+ end
end