My XML doc, which is the config file for a Jenkins job, has a lot of empty tags like:
which Nokogiri replaces with:
While this is the "recommended" way to write XML, it ends up generating unnecessary changes to the XML that make it difficult to read the meaningful content changes. Is there a way to suppress this behavior?
You can use the
doc.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS)
or the rather more concise: