diff options
Diffstat (limited to 'valid.c')
-rw-r--r-- | valid.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -18,6 +18,7 @@ #include <libxml/xmlmemory.h> #include <libxml/hash.h> +#include <libxml/uri.h> #include <libxml/valid.h> #include <libxml/parser.h> #include <libxml/parserInternals.h> @@ -6502,8 +6503,22 @@ xmlValidateDocument(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { } if ((doc->intSubset != NULL) && ((doc->intSubset->SystemID != NULL) || (doc->intSubset->ExternalID != NULL)) && (doc->extSubset == NULL)) { + xmlChar *sysID; + if (doc->intSubset->SystemID != NULL) { + sysID = xmlBuildURI(doc->intSubset->SystemID, + doc->URL); + if (sysID == NULL) { + xmlErrValid(ctxt, XML_DTD_LOAD_ERROR, + "Could not build URI for external subset \"%s\"\n", + (const char *) doc->intSubset->SystemID); + return 0; + } + } else + sysID = NULL; doc->extSubset = xmlParseDTD(doc->intSubset->ExternalID, - doc->intSubset->SystemID); + (const xmlChar *)sysID); + if (sysID != NULL) + xmlFree(sysID); if (doc->extSubset == NULL) { if (doc->intSubset->SystemID != NULL) { xmlErrValid(ctxt, XML_DTD_LOAD_ERROR, |