Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8184759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:36:51+00:00 2026-06-07T01:36:51+00:00

require ‘active_support/core_ext’ require ‘open-uri’ require ‘zip/zip’ zipfilename = open(url which returns a zip file

  • 0
 require 'active_support/core_ext'
 require 'open-uri'
 require 'zip/zip'


 zipfilename = open(url which returns a zip file with no of xml files inside)
 Zip::ZipFile.open(zipfilename) do |zipfile|
   zipfile.each do |entry|  
    xml = File.open(entry).read
    xml_to_hash = Hash.from_xml(xml)
   end
end

when i print try to print variable entry, it comes out as file_name.xml . Error comes from
xml = File.open(entry).read.

Error:

test.rb:51:in `initialize': can't convert Zip::ZipEntry into String (TypeError)
from test.rb:51:in `open'
from test.rb:51:in `block (2 levels) in <main>'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:36:53+00:00Added an answer on June 7, 2026 at 1:36 am

    the entry you are iterating over is not a real file. it just represents a file in your archive. i think that you need to transform your entry wich is of type Zip::ZipEntry into something that can be read.

    see the example at http://rubyzip.sourceforge.net/classes/Zip/ZipFile.html

    as far as i have seen you can get an io like object by calling get_input_stream or just call read: http://rubyzip.sourceforge.net/classes/Zip/ZipEntry.html#M000135

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

require 'open-uri' print Enter a URL add = gets open(#{add}) do |f| j =
require 'nokogiri' require 'open-uri' page = Nokogiri::HTML(open(http://wwp.greenwichmeantime.com/)) puts page.xpath(.//*[@id='offset']/span[1]).text this should output the gmt
require installed gems are not visible. Test with hpricot which I installed several times:
i require a generic accounting system database schema is there any sites which provide
I require the ability to preprocess a number of C# files as a prebuild
require dirname(__FILE__).'/yahooPHP/lib/Yahoo.inc'; This line is in one file in one directory and I am
require utils.lua stdin:1: module 'utils.lua' not found: no field package.preload['utils.lua'] no file 'D:\blizzard\Projects\Lua' no
I require a star rating control (which allows partial rating like 4.5) for my
I require to allow the user to select a file from the network drive
require('mq_class.php'); print_r(Minequery::query(64.31.24.137)); returns: Array ( [serverPort] => 25565 [playerCount] => 6 [maxPlayers] => 40

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.