more types, more coverage more problems fixed Daniel

* gentest.py testapi.c: more types, more coverage
* parser.c parserInternals.c relaxng.c valid.c xmlIO.c
  xmlschemastypes.c: more problems fixed
Daniel
diff --git a/xmlIO.c b/xmlIO.c
index 3e212ca..8528194 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -3436,7 +3436,7 @@
         /*
          * Do a local lookup
          */
-        if ((ctxt->catalogs != NULL) &&
+        if ((ctxt != NULL) && (ctxt->catalogs != NULL) &&
             ((pref == XML_CATA_ALLOW_ALL) ||
              (pref == XML_CATA_ALLOW_DOCUMENT))) {
             resource = xmlCatalogLocalResolve(ctxt->catalogs,
@@ -3462,7 +3462,7 @@
             && (!xmlSysIDExists((const char *) resource))) {
             xmlChar *tmp = NULL;
 
-            if ((ctxt->catalogs != NULL) &&
+            if ((ctxt != NULL) && (ctxt->catalogs != NULL) &&
                 ((pref == XML_CATA_ALLOW_ALL) ||
                  (pref == XML_CATA_ALLOW_DOCUMENT))) {
                 tmp = xmlCatalogLocalResolveURI(ctxt->catalogs, resource);
@@ -3624,7 +3624,7 @@
 	/*
 	 * Do a local lookup
 	 */
-	if ((ctxt->catalogs != NULL) &&
+	if ((ctxt != NULL) && (ctxt->catalogs != NULL) &&
 	    ((pref == XML_CATA_ALLOW_ALL) ||
 	     (pref == XML_CATA_ALLOW_DOCUMENT))) {
 	    resource = xmlCatalogLocalResolve(ctxt->catalogs,
@@ -3649,7 +3649,7 @@
 	if ((resource != NULL) && (!xmlNoNetExists((const char *)resource))) {
 	    xmlChar *tmp = NULL;
 
-	    if ((ctxt->catalogs != NULL) &&
+	    if ((ctxt != NULL) && (ctxt->catalogs != NULL) &&
 		((pref == XML_CATA_ALLOW_ALL) ||
 		 (pref == XML_CATA_ALLOW_DOCUMENT))) {
 		tmp = xmlCatalogLocalResolveURI(ctxt->catalogs, resource);