fixed bug #102181 by applying the suggested change and fixing the

* python/libxml.py python/libxml.c python/libxml2-python-api.xml:
  fixed bug #102181 by applying the suggested change and fixing
  the generation/registration problem.
Daniel
diff --git a/ChangeLog b/ChangeLog
index 77c0be4..34a6fed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Jan 10 14:13:03 CET 2003 Daniel Veillard <daniel@veillard.com>
+
+	* python/libxml.py python/libxml.c python/libxml2-python-api.xml:
+	  fixed bug #102181 by applying the suggested change and fixing
+	  the generation/registration problem.
+
 Fri Jan 10 13:47:55 CET 2003 Daniel Veillard <daniel@veillard.com>
 
 	* HTMLparser.c: fixed bug #102960 by reusing the XML name parsing
diff --git a/python/libxml.c b/python/libxml.c
index b48389b..b67c4eb 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -2195,6 +2195,7 @@
     {(char *) "outputBufferCreate", libxml_xmlCreateOutputBuffer, METH_VARARGS, NULL},
     {(char *) "inputBufferCreate", libxml_xmlCreateInputBuffer, METH_VARARGS, NULL},
     {(char *) "setEntityLoader", libxml_xmlSetEntityLoader, METH_VARARGS, NULL},
+    {(char *)"xmlRegisterErrorHandler", libxml_xmlRegisterErrorHandler, METH_VARARGS, NULL },
     {NULL, NULL, 0, NULL}
 };
 
diff --git a/python/libxml.py b/python/libxml.py
index a3d1bdd..d6c782d 100644
--- a/python/libxml.py
+++ b/python/libxml.py
@@ -462,6 +462,26 @@
 PARSER_SUBST_ENTITIES=4
 
 #
-# Everything below this point is automatically generated
+# register the libxml2 error handler
 #
+def registerErrorHandler(f, ctx):
+    """Register a Python written function to for error reporting.
+       The function is called back as f(ctx, error). """
+    import sys
+    if not sys.modules.has_key('libxslt'):
+        # normal behaviour when libxslt is not imported
+        ret = libxml2mod.xmlRegisterErrorHandler(f,ctx)
+    else:
+        # when libxslt is already imported, one must
+        # use libxst's error handler instead
+        import libxslt
+        ret = libxslt.registerErrorHandler(f,ctx)
+    return ret
+
+# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+#
+# Everything before this line comes from libxml.py 
+# Everything after this line is automatically generated
+#
+# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
 
diff --git a/python/libxml2-python-api.xml b/python/libxml2-python-api.xml
index 739b066..7e8e922 100644
--- a/python/libxml2-python-api.xml
+++ b/python/libxml2-python-api.xml
@@ -14,12 +14,6 @@
       <return type='xmlNodePtr' info="A new element node"/>
       <arg name='name' type='xmlChar *' info='the node name'/>
     </function>
-    <function name='xmlRegisterErrorHandler' file='python'>
-      <info>Register a Python written function to for error reporting. The function is called back as f(ctx, error).</info>
-      <return type='int' info="1 in case of success, 0 or -1 in case of error"/>
-      <arg name='f' type='pythonObject' info='the python function'/>
-      <arg name='ctx' type='pythonObject' info='a context for the callback'/>
-    </function>
     <function name='xmlCreatePushParser' file='python'>
       <info>Create a progressive XML parser context to build either an event flow if the SAX object is not None, or a DOM tree otherwise.</info>
       <return type='xmlParserCtxtPtr' info="the parser context or None in case of error"/>
diff --git a/python/libxml2class.txt b/python/libxml2class.txt
index 2fbc707..a96bd53 100644
--- a/python/libxml2class.txt
+++ b/python/libxml2class.txt
@@ -124,7 +124,6 @@
 htmlCreatePushParser()
 htmlSAXParseFile()
 newNode()
-registerErrorHandler()
 setEntityLoader()
 
 # functions from module tree