class NdrImport::File::Xml
This class is a xml file handler that returns a single table.
Private Instance Methods
rows(&block)
click to toggle source
Iterate through the file, yielding each 'xml_record_xpath' element in turn.
# File lib/ndr_import/file/xml.rb, line 18 def rows(&block) return enum_for(:rows) unless block xpath = @options['xml_record_xpath'] if @options['slurp'] doc = read_xml_file(@filename) doc.xpath(xpath).each(&block) else each_node(@filename, xpath, &block) end rescue StandardError => e raise("#{SafeFile.basename(@filename)} [#{e.class}: #{e.message}]") end