Skip to content

Instantly share code, notes, and snippets.

@ebot
Created January 27, 2010 20:36
Show Gist options
  • Save ebot/288132 to your computer and use it in GitHub Desktop.
Save ebot/288132 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby -wKU
require "rexml/document"
require 'FileUtils'
include REXML
# Update the xml
Dir.glob( "./*.bafxml" ) do |batch_file|
puts batch_file.to_s
doc = REXML::Document.new File.new( batch_file, 'r' )
XPath.each( doc, "//BatchAcqList/BatchAcq/OwnerList/Owner[@OwnerTypeName='BRAVOHEALTHF']/Label" ) do |object|
puts " #{object.name}"
object.name = 'label'
puts " NOW = #{object.name}"
end
# Save the doc
o = File.new( batch_file, 'w' )
doc.write( o, 0 )
o.close
puts " Saved"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment