Skip to content

Instantly share code, notes, and snippets.

@xwmx
Created April 7, 2010 20:27
Show Gist options
  • Save xwmx/359399 to your computer and use it in GitHub Desktop.
Save xwmx/359399 to your computer and use it in GitHub Desktop.
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