Created
October 17, 2014 23:03
-
-
Save mchow01/6dd1f6e3f5a069407918 to your computer and use it in GitHub Desktop.
Using Nokogiri to Parse a XML File (hosted remotely)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@companies = [] | |
begin | |
doc = Nokogiri::XML(open("https://rss.myinterfase.com/rss/tufts_Fall_Fair_2014_Empl_Reg_xml.xml")) | |
doc.css('Row').each do |elem| | |
# http://stackoverflow.com/questions/13520162/ruby-capitalize-every-word-first-letter | |
@companies << {:name => elem.css('orgname').text, :url => elem.css('reg_cnt_website').text} | |
end | |
@companies = @companies.sort_by{ |k| k[:name] } | |
rescue | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment