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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:14:35+00:00 2026-05-12T08:14:35+00:00

I tried using ActiveResource to parse a web service that was more like a

  • 0

I tried using ActiveResource to parse a web service that was more like a HTML document and I kept getting a 404 error.

Do I need to use an XML parser for this task instead of ActiveResource?

My guess is that ActiveResource is only useful if you are consuming data from another Rails app and the XML data is easily translatable to a Rails model. For example, if the web service is more wide-ranging XML like a HTML document or an RSS feed, you want to use a parser like hpricot or nokogiri. Is this correct?

How do you know when to use an XML parser and when to use ActiveResource?

  • 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-12T08:14:35+00:00Added an answer on May 12, 2026 at 8:14 am

    Update: ActiveResource is also not an XML parser. It is a REST consumer allowing you to interact with a remote resource similar to how you would an ActiveRecord model. It does use an XML parser under the hood (I’m assuming through ActiveSupport’s XmlMini I show below).

    ActiveResource has some strict requirements about the structure of the XML content and works best when interacting with the REST API of another Rails application. It is not intended to do generic screen scraping of an HTML page. For that use Nokogiri directly.


    ActiveSupport isn’t an XML parser, it is a miscellaneous collection of useful Ruby methods and classes. However, it does offer a wrapper around many different XML parsers giving you a consistent interface.

    You can see which XML parser is being used and switch to a different XML parser. Try this in script/console.

    ActiveSupport::XmlMini.backend # => ActiveSupport::XmlMini_REXML
    ActiveSupport::XmlMini.backend = 'Nokogiri'
    ActiveSupport::XmlMini.backend # => ActiveSupport::XmlMini_Nokogiri
    # it will now use Nokogiri
    

    However, that will still use the XML parser in Nokogiri which assumes strict, valid markup. Most HTML pages do not fit this strict requirement and therefore it is better to use Nokogiri’s HTML parser directly instead of going through ActiveSupport.

    doc = Nokogiri::HTML(...)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.