Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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)