Skip to content

Instantly share code, notes, and snippets.

@takuya-i
Created July 15, 2012 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takuya-i/3117040 to your computer and use it in GitHub Desktop.
Save takuya-i/3117040 to your computer and use it in GitHub Desktop.
Android strings.xml convert to csv fromat
#!/usr/local/bin/ruby
#
# Need "nokogiri" for xml parse
#
require "nokogiri"
file = File.open(ARGV[0])
xml_doc = Nokogiri::XML(file)
array = xml_doc.xpath("//string")
str = ""
array.each do |xpath_node|
str.concat( "#{xpath_node.attribute('name')}, #{xpath_node.text}\n")
end
puts str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment