more fixes and extending the tests coverage adding a type init interface

* gentest.py testapi.c: more fixes and extending the tests coverage
* relaxng.c include/libxml/relaxng.h: adding a type init interface
* include/libxml/xmlerror.h parser.c xmlreader.c xmlwriter.c: more
  cleanups and bug fixes raised by the regression tests
Daniel
diff --git a/xmlreader.c b/xmlreader.c
index e3243b9..f998ba2 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -1825,7 +1825,7 @@
     if (reader == NULL)
         return(-1);
     if (reader->doc == NULL) {
-        TODO
+        /* TODO */
 	return(-1);
     }
 
@@ -4629,6 +4629,9 @@
     if (reader == NULL)
         return (-1);
 
+    if (reader->input != NULL) {
+        xmlFreeParserInputBuffer(reader->input);
+    }
     if (reader->ctxt != NULL) {
 	xmlCtxtReset(reader->ctxt);
     }