changed the parsing of a document's DTD to use the proper base path (bug

* valid.c: changed the parsing of a document's DTD to use
  the proper base path (bug 144366)
diff --git a/ChangeLog b/ChangeLog
index 7d4f3ab..218773d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Aug  4 23:40:21 PDT 2004 William Brack <wbrack@mmm.com.hk>
+
+	* valid.c: changed the parsing of a document's DTD to use
+	  the proper base path (bug 144366)
+
 Wed Aug  4 16:58:08 CEST 2004 Daniel Veillard <daniel@veillard.com>
 
 	* Makefile.am config.h.in configure.in python/Makefile.am:
diff --git a/valid.c b/valid.c
index 18a1fde..1844ad2 100644
--- a/valid.c
+++ b/valid.c
@@ -6502,8 +6502,23 @@
     }
     if ((doc->intSubset != NULL) && ((doc->intSubset->SystemID != NULL) ||
 	(doc->intSubset->ExternalID != NULL)) && (doc->extSubset == NULL)) {
-        doc->extSubset = xmlParseDTD(doc->intSubset->ExternalID,
-		                     doc->intSubset->SystemID);
+	xmlChar *extID, *sysID;
+	if (doc->intSubset->ExternalID != NULL)
+	    extID = xmlBuildURI(doc->intSubset->ExternalID,
+	    		doc->URL);
+	else
+	    extID = NULL;
+	if (doc->intSubset->SystemID != NULL)
+	    sysID = xmlBuildURI(doc->intSubset->SystemID,
+	    		doc->URL);
+	else
+	    sysID = NULL;
+        doc->extSubset = xmlParseDTD((const xmlChar *)extID,
+			(const xmlChar *)sysID);
+	if (extID != NULL)
+	    xmlFree(extID);
+	if (sysID != NULL)
+	    xmlFree(sysID);
         if (doc->extSubset == NULL) {
 	    if (doc->intSubset->SystemID != NULL) {
 		xmlErrValid(ctxt, XML_DTD_LOAD_ERROR,