diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2002-10-17 13:51:17 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2002-10-17 13:51:17 +0000 |
commit | a2c84902867c12e3835081384e2f260a0603b20c (patch) | |
tree | d0ebce29d576313496a1e63227666326a860359f /xsltproc | |
parent | e47922a1ac7deabb131848dd5e02c21ab6c83648 (diff) | |
download | libxslt-a2c84902867c12e3835081384e2f260a0603b20c.tar.gz libxslt-a2c84902867c12e3835081384e2f260a0603b20c.tar.bz2 libxslt-a2c84902867c12e3835081384e2f260a0603b20c.zip |
added and tested the --path option to close #79638 Daniel
* xsltproc: added and tested the --path option to close #79638
Daniel
Diffstat (limited to 'xsltproc')
-rw-r--r-- | xsltproc/xsltproc.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/xsltproc/xsltproc.c b/xsltproc/xsltproc.c index 5022f33f..96d8cc1c 100644 --- a/xsltproc/xsltproc.c +++ b/xsltproc/xsltproc.c @@ -8,6 +8,7 @@ #include "libxslt/libxslt.h" #include "libexslt/exslt.h" +#include <stdio.h> #ifdef HAVE_STRING_H #include <string.h> #endif @@ -150,31 +151,49 @@ xmlExternalEntityLoader defaultEntityLoader = NULL; static xmlParserInputPtr xsltprocExternalEntityLoader(const char *URL, const char *ID, - xmlParserCtxtPtr context) { + xmlParserCtxtPtr ctxt) { xmlParserInputPtr ret; - xmlURIPtr uri; + warningSAXFunc warning = NULL; int i; + if ((ctxt != NULL) && (ctxt->sax != NULL)) { + warning = ctxt->sax->warning; + ctxt->sax->warning = NULL; + } + if (defaultEntityLoader != NULL) { - ret = defaultEntityLoader(URL, ID, context); - if (ret != NULL) + ret = defaultEntityLoader(URL, ID, ctxt); + if (ret != NULL) { + if (warning != NULL) + ctxt->sax->warning = warning; return(ret); + } } for (i = 0;i < nbpaths;i++) { xmlChar *newURL; int len; - len = xmlStrlen(paths[i]) + xmlStrlen(URL) + 5; + len = xmlStrlen(paths[i]) + xmlStrlen(BAD_CAST URL) + 5; newURL = xmlMalloc(len); if (newURL != NULL) { snprintf(newURL, len, "%s/%s", paths[i], URL); - ret = defaultEntityLoader((const char *)newURL, ID, context); + ret = defaultEntityLoader((const char *)newURL, ID, ctxt); xmlFree(newURL); - if (ret != NULL) + if (ret != NULL) { + if (warning != NULL) + ctxt->sax->warning = warning; return(ret); + } } } + if (warning != NULL) { + ctxt->sax->warning = warning; + if (URL != NULL) + warning(ctxt, "failed to load external entity \"%s\"\n", URL); + else if (ID != NULL) + warning(ctxt, "failed to load external entity \"%s\"\n", ID); + } return(NULL); } |