def Document_validateSchema(schema, doc, error_handler): validator_context = libxml2mod.xmlSchemaNewValidCtxt(schema) handler = ValidationHandler(error_handler) libxml2mod.xmlSchemaSetValidErrors(validator_context, handler.error, handler.warning, None) try: status = libxml2mod.xmlSchemaValidateDoc(validator_context, doc) return status == 0 finally: libxml2mod.xmlSchemaFreeValidCtxt(validator_context)
def setValidityErrorHandler(self, err_func, warn_func, arg=None): """ Register error and warning handlers for Schema validation. These will be called back as f(msg,arg) """ libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg)