mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
starts to look okay, really plugged the new framework, cleaned a lot of
* catalog.c parser.c xmlIO.c xmlcatalog.c xmllint.c include/libxml/catalog.h: starts to look okay, really plugged the new framework, cleaned a lot of stuff, added some APIs, except the PI's support missing this should be mostly complete * result/catalogs/* test/catalogs/*: added new test, enriched the existing one with URN ID tests Daniel
This commit is contained in:
21
xmlIO.c
21
xmlIO.c
@ -2371,7 +2371,10 @@ xmlParserInputPtr
|
||||
xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
|
||||
xmlParserCtxtPtr ctxt) {
|
||||
xmlParserInputPtr ret = NULL;
|
||||
const xmlChar *resource = NULL;
|
||||
xmlChar *resource = NULL;
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
struct stat info;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_EXTERNAL_ENTITIES
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
@ -2379,16 +2382,18 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
|
||||
#endif
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
/*
|
||||
* Try to load it from the resource pointed in the catalog
|
||||
* If the resource doesn't exists as a file,
|
||||
* try to load it from the resource pointed in the catalog
|
||||
*/
|
||||
if (ID != NULL)
|
||||
resource = xmlCatalogGetPublic((const xmlChar *)ID);
|
||||
if ((resource == NULL) && (URL != NULL))
|
||||
resource = xmlCatalogGetSystem((const xmlChar *)URL);
|
||||
#ifdef HAVE_STAT
|
||||
if ((URL == NULL) || (stat(URL, &info) < 0))
|
||||
#endif
|
||||
resource = xmlCatalogResolve((const xmlChar *)ID,
|
||||
(const xmlChar *)URL);
|
||||
#endif
|
||||
|
||||
if (resource == NULL)
|
||||
resource = (const xmlChar *)URL;
|
||||
resource = (xmlChar *) URL;
|
||||
|
||||
if (resource == NULL) {
|
||||
if ((ctxt->validate) && (ctxt->sax != NULL) &&
|
||||
@ -2410,6 +2415,8 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
|
||||
ctxt->sax->warning(ctxt,
|
||||
"failed to load external entity \"%s\"\n", resource);
|
||||
}
|
||||
if (resource != (xmlChar *) URL)
|
||||
xmlFree(resource);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user