Skip to content

Instantly share code, notes, and snippets.

@diogomonica
Created July 10, 2013 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diogomonica/5969962 to your computer and use it in GitHub Desktop.
Save diogomonica/5969962 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'nokogiri'
ATTRIBUTES = ['accelx', 'accely', 'accelz', 'altitude',
'depth', 'heading', 'lat', 'long', 'pitch',
'pitchrate', 'roll', 'rollrate', 'yawrate']
f = File.open(ARGV[0])
doc = Nokogiri::XML(f)
f.close
doc.xpath("//entry").each do |entry|
node_output = ''
entry.children.each do |node|
node_output << "#{node.name}; #{node.content}\n" if ATTRIBUTES.include?(node.name)
end
puts node_output
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment