Zip::ZipFile
represents the entire Zip container; what you need instead is inside this container, an object of class Zip::ZipEntry
. You could for example use Zip::ZipFile.read
to get a file with a specific name:
require 'zip/zip'
zip = Zip::ZipFile.open('some.zip') # open zip
xml_source = zip.read('filename_inside_zip.xml') # read file contents
# now use the contents of xml_source with Nokogiri
Or, if you don't know the name but there's always only one file in the Zip, you can just take the first one:
require 'zip/zip'
zip = Zip::ZipFile.open('some.zip') # open zip
entry = zip.entries.reject(&:directory?).first # take first non-directory
xml_source = entry.get_input_stream{|is| is.read } # read file contents
# now use the contents of xml_source with Nokogiri