Created
January 15, 2009 21:14
-
-
Save fizx/47625 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
require "rubygems" | |
require "dexterous" | |
require "pp" | |
file = ARGV.shift | |
unless file | |
puts "Usage: #{$0} FILE ID [ID2, ...]" | |
exit 1 | |
end | |
query = ARGV.inject({}) do |memo, arg| | |
memo["#{arg}(//location/[objid='#{arg}'])"] = { | |
"name" => "Name", | |
"address" => "Address", | |
} | |
memo | |
end | |
dex = Dexterous.new(query) | |
pp dex.parse(:file => file, :input => :xml) | |
# 111:~ kyle$ ruby locquery.rb locations_nyv.xml 669491 669502 | |
# {"669502"=> | |
# {"name"=>"PJ Clarke's", "address"=>"44 W 63rd St. | Lincoln Square"}, | |
# "669491"=>{"name"=>"Peep", "address"=>"177 Prince St."}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment