Created
February 14, 2013 21:25
-
-
Save faloi/4956543 to your computer and use it in GitHub Desktop.
remove_version
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 'Nokogiri' | |
xmlWildcard = "C:/Users/feder_000/Documents/Workspace/parsimotion/pages/**/*.xml" | |
allXmls = Dir[xmlWildcard] | |
allXmls.each{ |xml| | |
doc = Nokogiri::XML(open(xml)) | |
begin | |
doc.search('Page').attribute('Version').remove | |
file = File.open(xml, "w") | |
file.write(doc) | |
file.close | |
rescue NoMethodError=>e | |
puts "#{xml} doesn't have Version attribute!" | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment