Skip to content

Instantly share code, notes, and snippets.

@underhilllabs
Created December 1, 2015 18:22
Show Gist options
  • Save underhilllabs/4560a8eb612f61b39810 to your computer and use it in GitHub Desktop.
Save underhilllabs/4560a8eb612f61b39810 to your computer and use it in GitHub Desktop.
require 'nori'
def parse_file(file)
f = File.read(file)
parser = Nori.new(:convert_tags_to => lambda { |tag| tag.snakecase.to_sym }, :strip_namespaces => true)
parser.parse(f)
end
x = parse_file("./newvap_oc.xml")
refs = []
puts "here are the Study event Refs"
puts x[:odm][:study][:meta_data_version][:protocol][:study_event_ref]
x[:odm][:study][:meta_data_version][:protocol][:study_event_ref].each do |ref|
refs << ref[:@study_event_oid]
end
puts "here are the refs!"
refs.each do |ref|
puts ref
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment