Created
January 11, 2015 14:27
-
-
Save michiel/58f7c6de4058dac3d5b2 to your computer and use it in GitHub Desktop.
clean-xml.rb
This file contains hidden or 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' | |
file = File.read("dirty.xml") | |
xml = Nokogiri::XML(file) | |
# xml.xpath("//location").each do |node| | |
# node.content = node.content.gsub(/\n\s+/, " ") | |
# end | |
File.open("clean.xml", "w") do |f| | |
f.write xml.to_xml | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment