Created
April 7, 2010 20:27
-
-
Save xwmx/359399 to your computer and use it in GitHub Desktop.
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 'rubygems' | |
require 'nokogiri' | |
include Nokogiri | |
class PostCallbacks < XML::SAX::Document | |
def start_element(element, attributes) | |
puts "start element: #{element}" | |
puts "attributes: #{attributes.inspect}" | |
end | |
def characters(text) | |
puts "characters: #{text}" | |
end | |
def end_element(element) | |
puts "end element: #{element}" | |
end | |
end | |
parser = XML::SAX::Parser.new(PostCallbacks.new) | |
parser.parse_file("ucd.all.flat.xml") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment