Created
November 4, 2014 08:26
-
-
Save dforest/61cdcd81fb65e58bba23 to your computer and use it in GitHub Desktop.
Generate csv from strings.xml of android
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
require 'csv' | |
require 'nokogiri' | |
## | |
# First, you must wrap nodes by <sample> you want to generate csv | |
## | |
SAMPLE_TAG_NAME = "sample" | |
csv = CSV.open('strings.csv', 'w') | |
Nokogiri::XML(open(ARGV[0])).xpath("//#{SAMPLE_TAG_NAME}//string").each do |string| | |
csv << [string.attribute('name'), string.text] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment