Ruby XML

Parse XML stream: require "rexml/document" require "rexml/streamlistener" class MyListener include REXML::StreamListener def tag_start(name, attrs) case name when "a" # output href attribute of all  tags puts attrs["href"] end end end REXML::Document.parse_stream(File.new(ARGV[0]),MyListener.new)