reading huge, large xml in ruby made easy
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
README
reading_huge_xml.rb

README

HugeXML.read xml, elements_lookup do |element|
  # => element{ :name, :value, :attributes}
end

OR simply

HugeXML.read xml do |element|
# this will catch all opening elements

You can have some more control as

HugeXML.read xml, elements_lookup do |element, reader|

Here reader represents (Nokogir)pointer/cursor (but not actually itself is) which keeps on moving as we keep
on reading file stream. and has the following methods for us

element = reader.try_next elements
element = reader.try_next_with_value elements
element = reader.try_next_with_attributes elements

Note* use reader on trial basis :)

I just got one more similar example using ox
https://gist.github.com/amolpujari/5966431