I'm no expert, but this is how I would do it:

#!/usr/bin/ruby
require "rexml/document"
require "id3lib"
include REXML
include ID3Lib

File.new("collection.nml", 'r'){|inF|
   doc = Document.new(inF)

   doc.root.each_element("//ENTRY"){|node|
      #use File.join to ensure path is good and cross-platform
      file = File.join(node.elements["LOCATION"].attributes["DIR"],
                         node.elements["LOCATION"].attributes["FILE"])
      if File.exists?(file)
         #use 'unless' instead of 'if !'
         node.add_attribute "ARTIST" unless node.attributes["ARTIST"]
         #why assign Tag to a variable if only uses one?
         node.attributes["ARTIST"] = Tag.new(file).artist
      end
   }

   File.new("test.xml", "w+"){|out|
      #use block to ensure file is closed,
      doc.write out
   }
}


Cheers
Chris