Sha256: a50d4e8a6c654731e716efaa85d01887f1aaa85591db815e0353da44a9e14a40
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
# fgdc reader # History: # Stan Smith 2017-08-10 original script require 'nokogiri' require_relative 'modules/module_fgdc' module ADIWG module Mdtranslator module Readers module Fgdc def self.readFile(file, hResponseObj) # receive XML file if file.nil? || file == '' hResponseObj[:readerStructureMessages] << 'XML file is missing' hResponseObj[:readerStructurePass] = false return {} end # file must be well formed XML begin xDoc = Nokogiri::XML(file) { |form| form.strict } rescue Nokogiri::XML::SyntaxError => err hResponseObj[:readerStructureMessages] << 'XML file is not well formed' hResponseObj[:readerStructureMessages] << err hResponseObj[:readerStructurePass] = false return {} end # file must contain an fgdc <metadata> tag xMetadata = xDoc.xpath('/metadata') if xMetadata.empty? hResponseObj[:readerValidationMessages] << 'FGDC file did not contain a <metadata> tag' hResponseObj[:readerValidationPass] = false return {} end # load fgdc file into internal object return Fgdc.unpack(xDoc, hResponseObj) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems