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 9077743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:26:55+00:00 2026-06-16T19:26:55+00:00

I coded a little Ruby script that would parse a remote XML file and

  • 0

I coded a little Ruby script that would parse a remote XML file and extract some data from it using Nokogiri. Now I’m trying to code a more advanced version as a Rails application.

I have my code inside of a controller. It’s similar to the code that I used in my Ruby script, however it’s not working. I believe the error is because it’s trying to load the XML locally rather then externally.

Here is the error that Rails is giving me:

No such file or directory - http://mal-api.com/anime/10?format=xml

Here is a sample of the code in my controller: (I can provide the whole thing if needed, but it’s mainly just the default Rails scaffold code.)

def create
 require 'nokogiri'
 @anime = Anime.new(params[:anime])

 doc = Nokogiri::XML(open("http://mal-api.com/anime/#{@anime.mal_id}?format=xml"))

 #Title
 title = doc.css("anime english_title").inner_html
 #Snipped rails scaffold code
end

mal_id is passed in through a form. Nokogiri is added in my Gemfile.

Is there something I’m missing or that I’ve done wrong?
Any help is appreciated.

  • 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-16T19:26:56+00:00Added an answer on June 16, 2026 at 7:26 pm

    By default the open method in ruby is used to open files. If you want to directly open an URL you need to require 'open-uri'. More information can be found in the docs: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/open-uri/rdoc/OpenURI.html

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

Sidebar

Related Questions

Working on a little Ruby script that goes out to the web and crawls
Little question about Ruby error handling. I have some code that roughly resembles the
I am a little confused about object assignment and pointers in Ruby, and coded
I write a little ruby script, which sends me an email when a new
I needed a little script to read data out of windows-style .ini files. Searching
Coming from a Java background, I am a little perturbed by Ruby's completely blasé
Apologies -- I'm a newbie using Ruby on Rails. Still a little confused about
Working on pure-ruby implementation of XCode project file parser, PBXProject , and need little
I am trying to make a little ruby script to upload my own video
I've written a little ruby Sinatra app. From time to time an error is

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.