It may be ridiculous, but I have to ask.
I use Nokogiri to parse XML, remove certain tags, and write to the source file with the results. Using .remove leaves blank lines in XML. I am currently using regex to get rid of blank lines. Is there any built-in Nokogiri method that I should use?
Here is what I have:
require 'Nokogiri' io_path = "/path/to/metadata.xml" io = File.read(io_path) document = Nokogiri::XML(io) document.xpath('//artwork_files', '//tracks', '//previews').remove
ruby xml nokogiri
michaelmichael
source share