Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nordringrayhide/f674b5abd459bac4eb84 to your computer and use it in GitHub Desktop.
Save nordringrayhide/f674b5abd459bac4eb84 to your computer and use it in GitHub Desktop.
require "xmlsimple"
def transactions(filename)
data = XmlSimple.xml_in(filename)
data["LIST_G_CLIENT"][0]['G_CLIENT'][0]['LIST_G_ACC_CURR'][0]['G_ACC_CURR'][0]['LIST_G_TRANS_CARD'][0]['G_TRANS_CARD'][1]['LIST_G_TRANS_DETAILS'][0]['G_TRANS_DETAILS']
end
fields = %w(TRANS_DATE_XML TRANS_AMOUNT TRANS_CURR ACC_AMOUNT TRANS_DETAILS )
puts fields.join(", ")
transactions("report.xml").each do |transaction|
puts fields.map{|field| transaction[field]}.join(", ")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment