Skip to content

Instantly share code, notes, and snippets.

@darrenboyd
Created March 24, 2009 17:25
Show Gist options
  • Save darrenboyd/84238 to your computer and use it in GitHub Desktop.
Save darrenboyd/84238 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
xml_str = %Q{<peon>
<id>96586</id>
<stdout><![CDATA[This is STDOUT]]></stdout>
<stderr><![CDATA[This is STDERR]]></stderr>
</peon>}
require 'rubygems'
# gem 'hpricot', '0.6'
gem 'hpricot', '0.7'
require 'hpricot'
xml = Hpricot.parse(xml_str)
puts "STDOUT"
p (xml/:peon/:stdout).inner_text
puts "STDERR"
p (xml/:peon/:stderr).inner_text
# # Running with 0.6
# STDOUT
# "This is STDOUT"
# STDERR
# "This is STDERR"
# # Running with 0.7
# STDOUT
# ""
# STDERR
# ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment