I\'m creating an XML document: I want to unit test at least to make sure it\'s well-formed. So far, I have only been able to approximate this , by using the \'hasElements\'
rexml - build-in library. You can use a error handler to check your xml files
rexml
require 'rexml/document' include REXML errormsg = '' doc = nil begin doc = Document.new(File.new(filename)) rescue errormsg = $! end puts "Fail: #{errormsg}" if('' != errormsg)