fixed the way the generator works, extended the testing, especially with

* gentest.py testapi.c: fixed the way the generator works,
  extended the testing, especially with more real trees and nodes.
* HTMLtree.c tree.c valid.c xinclude.c xmlIO.c xmlsave.c: a bunch
  of real problems found and fixed.
* entities.c: fix error reporting to go through the new handlers
Daniel
diff --git a/xmlIO.c b/xmlIO.c
index 2c73f61..34d10b3 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -3048,7 +3048,9 @@
     int len;         /* number of bytes in str */
     int cons;        /* byte from str consumed */
 
-    if ((out == NULL) || (out->error) || (str == NULL)) return(-1);
+    if ((out == NULL) || (out->error) || (str == NULL) ||
+        (out->buffer == NULL) ||
+	(out->buffer->alloc == XML_BUFFER_ALLOC_IMMUTABLE)) return(-1);
     len = strlen((const char *)str);
     if (len < 0) return(0);
     if (out->error) return(-1);