<p>I have never worked with web services and rails, and obviously this is something I need to learn.
I have chosen to use hpricot because it looks great.
Anyway, _why's been nice enough to provide the following example on the <a href="http://code.whytheluckystiff.net/hpricot/" rel="nofollow noreferrer">hpricot website</a>:</p>

<pre><code> #!ruby
 require 'hpricot'
 require 'open-uri'
 # load the RedHanded home page
 doc = Hpricot(open("http://redhanded.hobix.com/index.html"))
 # change the CSS class on links
 (doc/"span.entryPermalink").set("class", "newLinks")
 # remove the sidebar
 (doc/"#sidebar").remove
 # print the altered HTML
 puts doc
</code></pre>

<p>Which looks simple, elegant, and easy peasey.
Works great in Ruby, but my question is: How do I break this up in rails?</p>

<p>I experimented with adding this all to a single controller, but couldn't think of the best way to call it in a view.</p>

<p>So if you were parsing an XML file from a web API and printing it in nice clean HTML with Hpricot, how would you break up the activity over the models, views, and controllers, and what would you put where?</p>

[{'answer_id': 28841, 'author': 'John Topley', 'author_id': 1450, 'author_profile': 'https://Stackoverflow.com/users/1450', 'pm_score': 0, 'selected': False, 'text': "<p>I'd probably go for a REST approach and have resources that represent the different entities within the XML file being consumed. Do you have a specific example of the XML that you can give?</p>\n"}, {'answer_id': 29500, 'author': 'Terry G Lorber', 'author_id': 809, 'author_profile': 'https://Stackoverflow.com/users/809', 'pm_score': 3, 'selected': True, 'text': "<p>Model, model, model, model, model.  Skinny controllers, simple views.</p>\n\n<p>The RedHandedHomePage model does the parsing on initialization, then call 'def render' in the controller, set output to an instance variable, and print that in a view.</p>\n"}]
['https://Stackoverflow.com/questions/28823', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2293/']