Hpricot Ruby Script to Digest ISO Currency Codes
UPDATE: I fixed a couple of bugs in this and changed the XML Schema DataType namespace alias to “xs”. You will likely want to remove some enumeration items because they aren’t particular useful for e-commerce applications, e.g. palladium troy ounce.
require 'hpricot'
require 'open-uri'
doc = Hpricot(open("http://en.wikipedia.org/wiki/ISO_4217"))
codetable = doc.search("//table[@class='wikitable sortable']")[0]
rows = codetable.search("//tr")
for i in 1..rows.length
tds = rows[i].search("//td")
unless rows[i] == nil
end
end
Also, here's a Powershell script to process the ISO 3166 country code list (semi-colon delimited):