diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2005-03-30 22:47:10 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2005-03-30 22:47:10 +0000 |
commit | 0e460da346bfb2cc9d5d6cb4be8f851c18bfb81e (patch) | |
tree | 3f0e29bb120f40ec8dd280274a2bf00c3f7a6273 /python/libxml.py | |
parent | bb8502c0ef2af706fbdff69119e994e40da64a88 (diff) | |
download | libxml2-0e460da346bfb2cc9d5d6cb4be8f851c18bfb81e.tar.gz |
another patch from Brent Hendricks to add new handlers with the various
* python/generator.py python/libxml.py: another patch from Brent
Hendricks to add new handlers with the various validity contexts
* python/tests/Makefile.am python/tests/validDTD.py
python/tests/validRNG.py python/tests/validSchemas.py: also
added the regression tests he provided
Daniel
Diffstat (limited to 'python/libxml.py')
-rw-r--r-- | python/libxml.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/python/libxml.py b/python/libxml.py index bde8aba4..2eca71e8 100644 --- a/python/libxml.py +++ b/python/libxml.py @@ -587,6 +587,45 @@ class parserCtxtCore: return libxml2mod.addLocalCatalog(self._o, uri) +class ValidCtxtCore: + + def __init__(self, *args, **kw): + pass + + def setValidityErrorHandler(self, err_func, warn_func, arg=None): + """ + Register error and warning handlers for DTD validation. + These will be called back as f(msg,arg) + """ + libxml2mod.xmlSetValidErrors(self._o, err_func, warn_func, arg) + + +class SchemaValidCtxtCore: + + def __init__(self, *args, **kw): + pass + + 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) + + +class relaxNgValidCtxtCore: + + def __init__(self, *args, **kw): + pass + + 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 _xmlTextReaderErrorFunc((f,arg),msg,severity,locator): """Intermediate callback to wrap the locator""" return f(arg,msg,severity,xmlTextReaderLocator(locator)) |