Nokogiri::XML::RelaxNG is used for validating XML against a RelaxNG schema.

Synopsis

Validate an XML document against a RelaxNG schema. Loop over the errors that are returned and print them out:

schema  = Nokogiri::XML::RelaxNG(File.open(ADDRESS_SCHEMA_FILE))
doc     = Nokogiri::XML(File.open(ADDRESS_XML_FILE))

schema.validate(doc).each do |error|
  puts error.message
end

The list of errors are Nokogiri::XML::SyntaxError objects.