lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb in adiwg-mdtranslator-0.10.2 vs lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb in adiwg-mdtranslator-0.12.0
- old
+ new
@@ -1,28 +1,57 @@
# Writer - internal data structure to ISO 19110:2003
# History:
# Stan Smith 2014-12-01 original script
+# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../iso/units'))
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../iso/codelists'))
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../iso/classes'))
+
require 'builder'
require 'date'
require 'uuidtools'
-require 'class_FCfeatureCatalogue'
+require 'adiwg/mdtranslator/writers/iso19110/class_FCfeatureCatalogue'
-$idCount = '_000'
+module ADIWG
+ module Mdtranslator
+ module Writers
+ module Iso
-class Iso19110Writer
+ # set writer namespace
+ $WriterNS = ADIWG::Mdtranslator::Writers::Iso
- def initialize
- end
+ class Iso19110
- def writeXML(internalObj)
+ def initialize
+ # reset ISO id='' counter
+ $idCount = '_000'
+ end
- # create new XML document
- xml = Builder::XmlMarkup.new(indent: 3)
- metadataWriter = FC_FeatureCatalogue.new(xml)
- metadata = metadataWriter.writeXML(internalObj)
+ def writeXML(intObj)
- return metadata
- end
+ # set the format of the output file based on the writer specified
+ $response[:writerFormat] = 'xml'
+ $response[:writerVersion] = ADIWG::Mdtranslator::VERSION
+ # create new XML document
+ xml = Builder::XmlMarkup.new(indent: 3)
+ metadataWriter = FC_FeatureCatalogue.new(xml)
+ metadata = metadataWriter.writeXML(intObj)
+
+ # set writer pass to true if no messages
+ # false or warning will be set by code that places the message
+ if $response[:writerMessages].length == 0
+ $response[:writerPass] = true
+ end
+
+ return metadata
+ end
+
+ end
+
+ end
+ end
+ end
end
+