Method: MARC::REXMLReader#each

Defined in:
lib/marc/xml_parsers.rb

#eachObject

Loop through the MARC records in the XML document



214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/marc/xml_parsers.rb', line 214

def each
  if block_given?
    while @parser.has_next?
      event = @parser.pull
      # if it's the start of a record element
      if event.start_element? && (strip_ns(event[0]) == "record")
        yield build_record
      end
    end
  else
    enum_for(:each)
  end
end