Created
January 27, 2009 14:31
-
-
Save nrk/53361 to your computer and use it in GitHub Desktop.
Hpricot on IronRuby
This file contains hidden or 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
require 'hpricot' | |
xml =<<XML | |
<items> | |
<item number="1"> | |
<name>item #1</name> | |
</item> | |
<item number="2"> | |
<title>item #2</title> | |
</item> | |
</items> | |
XML | |
puts "--- #{RUBY_ENGINE} ---" | |
Hpricot.scan(xml) { |token| p token } |
This file contains hidden or 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
--- ironruby --- | |
[:stag, "items", nil, "<items>"] | |
[:text, "\n ", nil, "\n "] | |
[:stag, "item", {"number"=>"1"}, "<item number=\"1\">"] | |
[:text, "\n ", nil, "\n "] | |
[:stag, "name", nil, "<name>"] | |
[:text, "item #1", nil, "item #1"] | |
[:etag, "name", nil, "</name>"] | |
[:text, "\n ", nil, "\n "] | |
[:etag, "item", nil, "</item>"] | |
[:text, "\n ", nil, "\n "] | |
[:stag, "item", {"number"=>"2"}, "<item number=\"2\">"] | |
[:text, "\n ", nil, "\n "] | |
[:stag, "title", nil, "<title>"] | |
[:text, "item #2", nil, "item #2"] | |
[:etag, "title", nil, "</title>"] | |
[:text, "\n ", nil, "\n "] | |
[:etag, "item", nil, "</item>"] | |
[:text, "\n", nil, "\n"] | |
[:etag, "items", nil, "</items>"] | |
[:text, "\n", nil, "\n"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment