require "libxml_test" xp = XML::Parser.new xp.string = ' assreally big ass' doc = xp.parse dtd = XML::Dtd.new(' ') if doc.validate(dtd) { |message, error| puts "#{error ? 'error' : 'warning'} : #{message}" } puts "validation passed" else puts "validation failed" end