Skip to content

Instantly share code, notes, and snippets.

@faloi
Created February 14, 2013 21:25
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 faloi/4956543 to your computer and use it in GitHub Desktop.
Save faloi/4956543 to your computer and use it in GitHub Desktop.
remove_version
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