Created
February 7, 2011 20:46
-
-
Save pragdave/815162 to your computer and use it in GitHub Desktop.
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
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 < Preprocessor</codeline> | |
<codeline> <cokw>def</cokw> map(line)</codeline> | |
<codeline> line.gsub(%r{<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