Exemple #1
0
def Document_validateRelaxNG(schema, doc, error_handler):
    validator_context = libxml2mod.xmlRelaxNGNewValidCtxt(schema)
    handler = ValidationHandler(error_handler)
    libxml2mod.xmlRelaxNGSetValidErrors(validator_context, handler.error, handler.warning, None)
    try:
        status = libxml2mod.xmlRelaxNGValidateDoc(validator_context, doc)
        return status == 0
    finally:
        libxml2mod.xmlRelaxNGFreeValidCtxt(validator_context)
Exemple #2
0
def Document_validateRelaxNG(schema, doc, error_handler):
    validator_context = libxml2mod.xmlRelaxNGNewValidCtxt(schema)
    handler = ValidationHandler(error_handler)
    libxml2mod.xmlRelaxNGSetValidErrors(validator_context, handler.error, handler.warning, None)
    try:
        status = libxml2mod.xmlRelaxNGValidateDoc(validator_context, doc)
        return status == 0
    finally:
        libxml2mod.xmlRelaxNGFreeValidCtxt(validator_context)
 def setValidityErrorHandler(self, err_func, warn_func, arg=None):
     """
     Register error and warning handlers for RelaxNG validation.
     These will be called back as f(msg,arg)
     """
     libxml2mod.xmlRelaxNGSetValidErrors(self._o, err_func, warn_func, arg)
 def setValidityErrorHandler(self, err_func, warn_func, arg=None):
     """
     Register error and warning handlers for RelaxNG validation.
     These will be called back as f(msg,arg)
     """
     libxml2mod.xmlRelaxNGSetValidErrors(self._o, err_func, warn_func, arg)