1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-11 21:41:53 +03:00

more accessor classes for the parser context, allow to switch on and check

* python/TODO python/generator.py python/libxml2-python-api.xml
  python/libxml2class.txt: more accessor classes for the parser
  context, allow to switch on and check validity
* python/tests/Makefile.am python/tests/error.py
  python/tests/invalid.xml python/tests/valid.xml
  python/tests/validate.py: attded more test and and added error.py
  which I forgot to commit in the last step
Daniel
This commit is contained in:
Daniel Veillard
2002-02-03 16:53:19 +00:00
parent 3ce5257b29
commit 26f1dcc5bd
10 changed files with 189 additions and 7 deletions

30
python/tests/error.py Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/python -u
#
# This test exercise the redirection of error messages with a
# functions defined in Python.
#
import sys
import libxml2
expect='--> warning: --> failed to load external entity "missing.xml"\n'
err=""
def callback(ctx, str):
global err
err = err + "%s %s" % (ctx, str)
libxml2.registerErrorHandler(callback, "-->")
doc = libxml2.parseFile("missing.xml")
if err != expect:
print "error"
print "received %s" %(err)
print "expected %s" %(expect)
sys.exit(1)
i = 10000
while i > 0:
doc = libxml2.parseFile("missing.xml")
err = ""
i = i - 1
print "OK"