1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-08-01 10:06:59 +03:00

added support and APIs needed for the catalog PI cleanup Daniel

* include/libxml/catalog.h include/libxml/parser.h
  include/libxml/xmlerror.h catalog.c parser.c parserInternals.c
  xmlIO.c: added support and APIs needed for the catalog PI
* include/libxml/xmlIO.h: cleanup
Daniel
This commit is contained in:
Daniel Veillard
2001-08-22 14:29:45 +00:00
parent e2940ddb35
commit 5d90b6c983
9 changed files with 315 additions and 9 deletions

36
xmlIO.c
View File

@ -2374,6 +2374,7 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
xmlChar *resource = NULL;
#ifdef LIBXML_CATALOG_ENABLED
struct stat info;
xmlCatalogAllow pref;
#endif
#ifdef DEBUG_EXTERNAL_ENTITIES
@ -2385,11 +2386,40 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
* If the resource doesn't exists as a file,
* try to load it from the resource pointed in the catalog
*/
pref = xmlCatalogGetDefaults();
if ((pref != XML_CATA_ALLOW_NONE)
#ifdef HAVE_STAT
if ((URL == NULL) || (stat(URL, &info) < 0))
&& ((URL == NULL) || (stat(URL, &info) < 0))
#endif
resource = xmlCatalogResolve((const xmlChar *)ID,
(const xmlChar *)URL);
) {
/*
* Do a local lookup
*/
if ((ctxt->catalogs != NULL) &&
((pref == XML_CATA_ALLOW_ALL) ||
(pref == XML_CATA_ALLOW_DOCUMENT))) {
resource = xmlCatalogLocalResolve(ctxt->catalogs,
(const xmlChar *)ID,
(const xmlChar *)URL);
}
/*
* Do a global lookup
*/
if (((resource == NULL)
#ifdef HAVE_STAT
|| (stat((const char *) resource, &info) < 0)
#endif
) && ((pref == XML_CATA_ALLOW_ALL) ||
(pref == XML_CATA_ALLOW_GLOBAL))) {
resource = xmlCatalogResolve((const xmlChar *)ID,
(const xmlChar *)URL);
}
/*
* TODO: do an URI lookup on the reference
*/
}
#endif
if (resource == NULL)