1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-06-13 19:21:37 +03:00

applied a patch from Stphane Bidoul to allow per XMLtextReader error and

* xmlreader.c include/libxml/xmlreader.h python/generator.py
  python/libxml.c python/libxml.py win32/libxml2.def.src: applied
  a patch from Stphane Bidoul to allow per XMLtextReader error
  and warning handling
* python/tests/Makefile.am python/tests/readererr.py: adding the
  specific regression test
Daniel
This commit is contained in:
Daniel Veillard
2003-01-16 22:45:08 +00:00
parent 71f9d7310c
commit 26f70269c8
9 changed files with 390 additions and 3 deletions

View File

@ -461,6 +461,14 @@ PARSER_DEFAULTATTRS=2
PARSER_VALIDATE=3
PARSER_SUBST_ENTITIES=4
#
# For the xmlTextReader error severities
#
XMLREADER_SEVERITY_VALIDITY_WARNING=1
XMLREADER_SEVERITY_VALIDITY_ERROR=2
XMLREADER_SEVERITY_WARNING=3
XMLREADER_SEVERITY_ERROR=4
#
# register the libxml2 error handler
#
@ -497,6 +505,28 @@ class parserCtxtCore:
def registerWarningHandler(self,f,arg):
libxml2mod.xmlSetParserCtxtWarningHandler(self._o,f,arg)
class xmlTextReaderCore:
def __init__(self, _obj=None):
self.input = None
if _obj != None:self._o = _obj;return
self._o = None
def __del__(self):
if self._o != None:
libxml2mod.xmlFreeTextReader(self._o)
self._o = None
def setErrorHandler(self,f,arg):
"""Register an error handler that will be called back as
f(arg,msg,line,col,URI,severity)."""
libxml2mod.xmlTextReaderSetErrorHandler(self._o,f,arg)
def getErrorHandler(self):
"""Return (f,arg) as previously registered with setErrorHandler
or (None,None)."""
return libxml2mod.xmlTextReaderGetErrorHandler(self._o)
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
#
# Everything before this line comes from libxml.py