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

  • SEARCH
  • Home
  • 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 5975777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:08:03+00:00 2026-05-22T21:08:03+00:00

I am trying to parse an XML file from a URL. When I try

  • 0

I am trying to parse an XML file from a URL. When I try something like this:

require 'net/http'
require 'rubygems'
require 'xmlsimple'

url = 'http://my-address.com/xmltest/note.xml'
xml_data = Net::HTTP.get_response(URI.parse(url)).body

Everything works, but only when I do this outside of my Rails project. If I try including this file in my Rails 3 project and parsing it there, I get the error "Errno::ECONNREFUSED in [controller]" - Connection refused - connect(2).

My problem is the following: I don’t know how to install the net/http component. I am looking for it on http://www.rubygems.org, but I can’t find it.

  • 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-05-22T21:08:04+00:00Added an answer on May 22, 2026 at 9:08 pm

    Net::HTTP is part of Ruby’s standard library. You can use require 'net/http' to load it.

    Rather than use Net::HTTP, which is fairly low-level for what you want to do, I’d recommend using Ruby’s Open::URI.

    If you are moving a lot of HTTP data, you might want to look into something like HTTPClient or Curb or Typhoeus, which are designed for heavy-weight use and save you the trouble of having to write it all using Net::HTTP.

    Regarding the ECONNREFUSED error: you might want to capture the HTTPResponse returned from get_response, then check its status before trying to read the body. The way you’re doing it now doesn’t let you react to a failed request.

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

Sidebar

Related Questions

in my app i am trying to parse an xml file from a url.
Im trying to parse a Xml file from a URL, the xml is actually
I am trying to parse an XML file from a URL by taking all
I want to parse an XML file from URL using JDOM. But when trying
I am trying to get xml file from url link . This code for
I am beginner in PHP. I am trying to parse this xml file. <relationship>
I'm trying to parse data from Archive.org's search functionality. The data looks like this:
I am trying to read a xml file from the web and parse it
Here is a snippet from the XML file I am trying to parse: <Item
i'm trying to parse this xml file but i can't find a way to

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.