Skip to content

Instantly share code, notes, and snippets.

@govaniso
Created May 25, 2017 22:32
Show Gist options
  • Save govaniso/e632f9b117833c142b3df2c103555e86 to your computer and use it in GitHub Desktop.
Save govaniso/e632f9b117833c142b3df2c103555e86 to your computer and use it in GitHub Desktop.
Leer XML en ruby con Nokigiri
#encoding: utf-8
require 'nokogiri'
name_xml_file = "archivo.xml"
f = File.open(name_xml_file)
xml = Nokogiri::XML(f)
body = xml.xpath("//s0:invoices")
body.xpath("//s0:uuid").each do |e|
puts e.content
end
# Salida:
#
# 7F53D32C-1234-0000-AE5B-63237381AC1A
# 05E5DF90-1234-1234-0000-1BE7DBBF9E33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment