class Nokogiri::XML::Schema
def validate_document document
def validate_document document errors = [] ctx = LibXML.xmlSchemaNewValidCtxt(cstruct) raise RuntimeError.new("Could not create a validation context") if ctx.null? LibXML.xmlSchemaSetValidStructuredErrors(ctx, SyntaxError.error_array_pusher(errors), nil) unless Nokogiri.is_2_6_16? LibXML.xmlSchemaValidateDoc(ctx, document.cstruct) LibXML.xmlSchemaFreeValidCtxt(ctx) errors end