コード例 #1
0
ファイル: macrolib.py プロジェクト: fengyue23010/zolspider
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)
コード例 #2
0
ファイル: macrolib.py プロジェクト: juanchitot/jaimeboot
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)
コード例 #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)
コード例 #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)