Skip to content

Instantly share code, notes, and snippets.

@pragdave
Created February 7, 2011 20:46
Show Gist options
  • Save pragdave/815162 to your computer and use it in GitHub Desktop.
Save pragdave/815162 to your computer and use it in GitHub Desktop.
if RUBY_PLATFORM =~ /java/
ENV["GEM_HOME"] = ENV["GEM_PATH"] = nil
require 'rubygems'
gem 'nokogiri'
end
require 'nokogiri'
doc = Nokogiri::XML.parse(DATA.read, nil, 'utf-8')
p doc.errors
puts doc.to_xml
__END__
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book SYSTEM "unused.dtd">
<book code="_authorinfo" in-beta="yes">
<processedcode language="ruby" size="normal">
<codeline><cokw>class</cokw> Fred &lt; Preprocessor</codeline>
<codeline> <cokw>def</cokw> map(line)</codeline>
<codeline> line.gsub(%r{&lt;ror/>}, <costring>"Ruby on Rails"</costring>)</codeline>
<codeline> <cokw>end</cokw></codeline>
<codeline><cokw>end</cokw></codeline>
</processedcode>
</book>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment