Created
July 15, 2012 14:02
-
-
Save takuya-i/3117040 to your computer and use it in GitHub Desktop.
Android strings.xml convert to csv fromat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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