ruby-libxml.rb 271 B

1234567891011121314151617
  1. #!/usr/bin/ruby -w
  2. require 'libxml'
  3. include LibXML
  4. class PostCallbacks
  5. include XML::SaxParser::Callbacks
  6. def on_start_element(element, attributes)
  7. puts element
  8. end
  9. end
  10. parser = XML::SaxParser.file(ARGV[0])
  11. parser.callbacks = PostCallbacks.new
  12. parser.parse