applied patch from Mark Vadoc to not use SAX1 unless necessary. Daniel

* HTMLparser.c relaxng.c testRelax.c testSchemas.c: applied
  patch from Mark Vadoc to not use SAX1 unless necessary.
Daniel
diff --git a/ChangeLog b/ChangeLog
index 37fbdb1..08d7c69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Jan 13 21:39:58 CET 2004 Daniel Veillard <daniel@veillard.com>
+
+	* HTMLparser.c relaxng.c testRelax.c testSchemas.c: applied
+	  patch from Mark Vadoc to not use SAX1 unless necessary.
+
 Mon Jan 12 17:22:57 CET 2004 Daniel Veillard <daniel@veillard.com>
 
 	* dict.c parser.c xmlstring.c: some parser optimizations,
diff --git a/HTMLparser.c b/HTMLparser.c
index a2d7616..7c0d32a 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -5173,9 +5173,11 @@
     }
     canonicFilename = (char *) xmlCanonicPath((const xmlChar *) filename);
     if (canonicFilename == NULL) {
+#ifdef LIBXML_SAX1_ENABLED
 	if (xmlDefaultSAXHandler.error != NULL) {
 	    xmlDefaultSAXHandler.error(NULL, "out of memory\n");
 	}
+#endif
 	xmlFreeParserCtxt(ctxt);
 	return(NULL);
     }
diff --git a/doc/examples/xpath1.c b/doc/examples/xpath1.c
index 8bc10fc..f6e939b 100644
--- a/doc/examples/xpath1.c
+++ b/doc/examples/xpath1.c
@@ -162,7 +162,7 @@
 	next = (xmlChar*)xmlStrchr(next, '=');
 	if(next == NULL) {
 	    fprintf(stderr,"Error: invalid namespaces list format\n");
-	    free(nsListDup);
+	    xmlFree(nsListDup);
 	    return(-1);	
 	}
 	*(next++) = '\0';	
@@ -177,12 +177,12 @@
 	/* do register namespace */
 	if(xmlXPathRegisterNs(xpathCtx, prefix, href) != 0) {
 	    fprintf(stderr,"Error: unable to register NS with prefix=\"%s\" and href=\"%s\"\n", prefix, href);
-	    free(nsListDup);
+	    xmlFree(nsListDup);
 	    return(-1);	
 	}
     }
     
-    free(nsListDup);
+    xmlFree(nsListDup);
     return(0);
 }
 
diff --git a/relaxng.c b/relaxng.c
index e1def1c..985eff2 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -1569,7 +1569,7 @@
     /*
      * load the document
      */
-    doc = xmlParseFile((const char *) URL);
+    doc = xmlReadFile((const char *) URL,NULL,0);
     if (doc == NULL) {
         xmlRngPErr(ctxt, node, XML_RNGP_PARSE_ERROR,
                    "xmlRelaxNG: could not load %s\n", URL, NULL);
@@ -1901,7 +1901,7 @@
     /*
      * load the document
      */
-    doc = xmlParseFile((const char *) URL);
+    doc = xmlReadFile((const char *) URL,NULL,0);
     if (doc == NULL) {
         xmlRngPErr(ctxt, NULL, XML_RNGP_PARSE_ERROR,
                    "xmlRelaxNG: could not load %s\n", URL, NULL);
@@ -7240,7 +7240,7 @@
      * First step is to parse the input document into an DOM/Infoset
      */
     if (ctxt->URL != NULL) {
-        doc = xmlParseFile((const char *) ctxt->URL);
+        doc = xmlReadFile((const char *) ctxt->URL,NULL,0);
         if (doc == NULL) {
             xmlRngPErr(ctxt, NULL, XML_RNGP_PARSE_ERROR,
                        "xmlRelaxNGParse: could not load %s\n", ctxt->URL,
@@ -7248,7 +7248,7 @@
             return (NULL);
         }
     } else if (ctxt->buffer != NULL) {
-        doc = xmlParseMemory(ctxt->buffer, ctxt->size);
+        doc = xmlReadMemory(ctxt->buffer, ctxt->size,NULL,NULL,0);
         if (doc == NULL) {
             xmlRngPErr(ctxt, NULL, XML_RNGP_PARSE_ERROR,
                        "xmlRelaxNGParse: could not parse schemas\n", NULL,
diff --git a/testRelax.c b/testRelax.c
index dee4715..e18b3c2 100644
--- a/testRelax.c
+++ b/testRelax.c
@@ -134,7 +134,7 @@
 	    } else {
 		xmlDocPtr doc;
 
-		doc = xmlParseFile(argv[i]);
+		doc = xmlReadFile(argv[i],NULL,0);
 
 		if (doc == NULL) {
 		    fprintf(stderr, "Could not parse %s\n", argv[i]);
diff --git a/testSchemas.c b/testSchemas.c
index de12e25..47f8b39 100644
--- a/testSchemas.c
+++ b/testSchemas.c
@@ -125,7 +125,7 @@
 	    } else {
 		xmlDocPtr doc;
 
-		doc = xmlParseFile(argv[i]);
+		doc = xmlReadFile(argv[i],NULL,0);
 
 		if (doc == NULL) {
 		    fprintf(stderr, "Could not parse %s\n", argv[i]);