mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-07-29 15:41:13 +03:00
implemented --nodtdattr to avoid defaulting DTD attributes, RFE 150311 .
* xsltproc/xsltproc.c: implemented --nodtdattr to avoid defaulting DTD attributes, RFE 150311 . Also cleanup the code from all libxml2 pre 2.6.0 specific code since we are using LIBXML_REQUIRED_VERSION=2.6.8 in configure.in Daniel
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
Wed Aug 18 00:22:00 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xsltproc/xsltproc.c: implemented --nodtdattr to avoid defaulting
|
||||||
|
DTD attributes, RFE 150311 . Also cleanup the code from all
|
||||||
|
libxml2 pre 2.6.0 specific code since we are using
|
||||||
|
LIBXML_REQUIRED_VERSION=2.6.8 in configure.in
|
||||||
|
|
||||||
Tue Aug 17 01:01:22 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
Tue Aug 17 01:01:22 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* libxslt/documents.c libxslt/documents.h libxslt/imports.c
|
* libxslt/documents.c libxslt/documents.h libxslt/imports.c
|
||||||
|
@ -91,6 +91,7 @@ static int repeat = 0;
|
|||||||
static int timing = 0;
|
static int timing = 0;
|
||||||
static int dumpextensions = 0;
|
static int dumpextensions = 0;
|
||||||
static int novalid = 0;
|
static int novalid = 0;
|
||||||
|
static int nodtdattr = 0;
|
||||||
static int noout = 0;
|
static int noout = 0;
|
||||||
#ifdef LIBXML_HTML_ENABLED
|
#ifdef LIBXML_HTML_ENABLED
|
||||||
static int html = 0;
|
static int html = 0;
|
||||||
@ -104,9 +105,7 @@ static int profile = 0;
|
|||||||
#define MAX_PARAMETERS 64
|
#define MAX_PARAMETERS 64
|
||||||
#define MAX_PATHS 64
|
#define MAX_PATHS 64
|
||||||
|
|
||||||
#if LIBXML_VERSION >= 20600
|
|
||||||
static int options = XSLT_PARSE_OPTIONS;
|
static int options = XSLT_PARSE_OPTIONS;
|
||||||
#endif
|
|
||||||
static const char *params[MAX_PARAMETERS + 1];
|
static const char *params[MAX_PARAMETERS + 1];
|
||||||
static int nbparams = 0;
|
static int nbparams = 0;
|
||||||
static xmlChar *strparams[MAX_PARAMETERS + 1];
|
static xmlChar *strparams[MAX_PARAMETERS + 1];
|
||||||
@ -394,21 +393,12 @@ xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur, const char *filename) {
|
|||||||
res = xsltApplyStylesheet(cur, doc, params);
|
res = xsltApplyStylesheet(cur, doc, params);
|
||||||
xmlFreeDoc(res);
|
xmlFreeDoc(res);
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
#if LIBXML_VERSION >= 20600
|
|
||||||
#ifdef LIBXML_HTML_ENABLED
|
#ifdef LIBXML_HTML_ENABLED
|
||||||
if (html)
|
if (html)
|
||||||
doc = htmlReadFile(filename, NULL, options);
|
doc = htmlReadFile(filename, NULL, options);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
doc = xmlReadFile(filename, NULL, options);
|
doc = xmlReadFile(filename, NULL, options);
|
||||||
#else
|
|
||||||
#ifdef LIBXML_HTML_ENABLED
|
|
||||||
if (html)
|
|
||||||
doc = htmlParseFile(filename, NULL);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
doc = xmlParseFile(filename);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctxt = xsltNewTransformContext(cur, doc);
|
ctxt = xsltNewTransformContext(cur, doc);
|
||||||
@ -510,11 +500,10 @@ static void usage(const char *name) {
|
|||||||
#endif
|
#endif
|
||||||
printf("\t--dumpextensions: dump the registered extension elements and functions to stdout\n");
|
printf("\t--dumpextensions: dump the registered extension elements and functions to stdout\n");
|
||||||
printf("\t--novalid skip the Dtd loading phase\n");
|
printf("\t--novalid skip the Dtd loading phase\n");
|
||||||
|
printf("\t--nodtdattr do not default attributes from the DTD\n");
|
||||||
printf("\t--noout: do not dump the result\n");
|
printf("\t--noout: do not dump the result\n");
|
||||||
printf("\t--maxdepth val : increase the maximum depth\n");
|
printf("\t--maxdepth val : increase the maximum depth\n");
|
||||||
#if LIBXML_VERSION >= 20600
|
|
||||||
printf("\t--maxparserdepth val : increase the maximum parser depth\n");
|
printf("\t--maxparserdepth val : increase the maximum parser depth\n");
|
||||||
#endif
|
|
||||||
#ifdef LIBXML_HTML_ENABLED
|
#ifdef LIBXML_HTML_ENABLED
|
||||||
printf("\t--html: the input document is(are) an HTML file(s)\n");
|
printf("\t--html: the input document is(are) an HTML file(s)\n");
|
||||||
#endif
|
#endif
|
||||||
@ -609,6 +598,9 @@ main(int argc, char **argv)
|
|||||||
} else if ((!strcmp(argv[i], "-novalid")) ||
|
} else if ((!strcmp(argv[i], "-novalid")) ||
|
||||||
(!strcmp(argv[i], "--novalid"))) {
|
(!strcmp(argv[i], "--novalid"))) {
|
||||||
novalid++;
|
novalid++;
|
||||||
|
} else if ((!strcmp(argv[i], "-nodtdattr")) ||
|
||||||
|
(!strcmp(argv[i], "--nodtdattr"))) {
|
||||||
|
nodtdattr++;
|
||||||
} else if ((!strcmp(argv[i], "-noout")) ||
|
} else if ((!strcmp(argv[i], "-noout")) ||
|
||||||
(!strcmp(argv[i], "--noout"))) {
|
(!strcmp(argv[i], "--noout"))) {
|
||||||
noout++;
|
noout++;
|
||||||
@ -719,7 +711,6 @@ main(int argc, char **argv)
|
|||||||
if (value > 0)
|
if (value > 0)
|
||||||
xsltMaxDepth = value;
|
xsltMaxDepth = value;
|
||||||
}
|
}
|
||||||
#if LIBXML_VERSION >= 20600
|
|
||||||
} else if ((!strcmp(argv[i], "-maxparserdepth")) ||
|
} else if ((!strcmp(argv[i], "-maxparserdepth")) ||
|
||||||
(!strcmp(argv[i], "--maxparserdepth"))) {
|
(!strcmp(argv[i], "--maxparserdepth"))) {
|
||||||
int value;
|
int value;
|
||||||
@ -729,7 +720,6 @@ main(int argc, char **argv)
|
|||||||
if (value > 0)
|
if (value > 0)
|
||||||
xmlParserMaxDepth = value;
|
xmlParserMaxDepth = value;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
} else if ((!strcmp(argv[i],"-dumpextensions"))||
|
} else if ((!strcmp(argv[i],"-dumpextensions"))||
|
||||||
(!strcmp(argv[i],"--dumpextensions"))) {
|
(!strcmp(argv[i],"--dumpextensions"))) {
|
||||||
dumpextensions++;
|
dumpextensions++;
|
||||||
@ -742,20 +732,10 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
params[nbparams] = NULL;
|
params[nbparams] = NULL;
|
||||||
|
|
||||||
#if LIBXML_VERSION < 20600
|
|
||||||
/*
|
|
||||||
* The old parser interfaces uses the global variables
|
|
||||||
*/
|
|
||||||
if (novalid == 0)
|
|
||||||
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
|
||||||
else
|
|
||||||
xmlLoadExtDtdDefaultValue = 0;
|
|
||||||
xmlSubstituteEntitiesDefault(1);
|
|
||||||
xmlLineNumbersDefault(1);
|
|
||||||
#else
|
|
||||||
if (novalid != 0)
|
if (novalid != 0)
|
||||||
options = XML_PARSE_NOENT | XML_PARSE_NOCDATA;
|
options = XML_PARSE_NOENT | XML_PARSE_NOCDATA;
|
||||||
#endif
|
else if (nodtdattr)
|
||||||
|
options = XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_NOCDATA;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register the EXSLT extensions and the test module
|
* Register the EXSLT extensions and the test module
|
||||||
@ -771,12 +751,10 @@ main(int argc, char **argv)
|
|||||||
(!strcmp(argv[i], "--maxdepth"))) {
|
(!strcmp(argv[i], "--maxdepth"))) {
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
#if LIBXML_VERSION >= 20600
|
|
||||||
} else if ((!strcmp(argv[i], "-maxparserdepth")) ||
|
} else if ((!strcmp(argv[i], "-maxparserdepth")) ||
|
||||||
(!strcmp(argv[i], "--maxparserdepth"))) {
|
(!strcmp(argv[i], "--maxparserdepth"))) {
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
#endif
|
|
||||||
} else if ((!strcmp(argv[i], "-o")) ||
|
} else if ((!strcmp(argv[i], "-o")) ||
|
||||||
(!strcmp(argv[i], "-output")) ||
|
(!strcmp(argv[i], "-output")) ||
|
||||||
(!strcmp(argv[i], "--output"))) {
|
(!strcmp(argv[i], "--output"))) {
|
||||||
@ -803,11 +781,7 @@ main(int argc, char **argv)
|
|||||||
if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
|
if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
|
||||||
if (timing)
|
if (timing)
|
||||||
startTimer();
|
startTimer();
|
||||||
#if LIBXML_VERSION >= 20600
|
|
||||||
style = xmlReadFile((const char *) argv[i], NULL, options);
|
style = xmlReadFile((const char *) argv[i], NULL, options);
|
||||||
#else
|
|
||||||
style = xmlParseFile((const char *) argv[i]);
|
|
||||||
#endif
|
|
||||||
if (timing)
|
if (timing)
|
||||||
endTimer("Parsing stylesheet %s", argv[i]);
|
endTimer("Parsing stylesheet %s", argv[i]);
|
||||||
if (style == NULL) {
|
if (style == NULL) {
|
||||||
@ -841,35 +815,18 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBXML_VERSION < 20600
|
|
||||||
/*
|
|
||||||
* The old parser interfaces uses the global variables
|
|
||||||
* disable CDATA from being built in the document tree
|
|
||||||
*/
|
|
||||||
xmlDefaultSAXHandlerInit();
|
|
||||||
xmlDefaultSAXHandler.cdataBlock = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((cur != NULL) && (cur->errors == 0)) {
|
if ((cur != NULL) && (cur->errors == 0)) {
|
||||||
for (; i < argc; i++) {
|
for (; i < argc; i++) {
|
||||||
doc = NULL;
|
doc = NULL;
|
||||||
if (timing)
|
if (timing)
|
||||||
startTimer();
|
startTimer();
|
||||||
#if LIBXML_VERSION >= 20600
|
|
||||||
#ifdef LIBXML_HTML_ENABLED
|
#ifdef LIBXML_HTML_ENABLED
|
||||||
if (html)
|
if (html)
|
||||||
doc = htmlReadFile(argv[i], NULL, options);
|
doc = htmlReadFile(argv[i], NULL, options);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
doc = xmlReadFile(argv[i], NULL, options);
|
doc = xmlReadFile(argv[i], NULL, options);
|
||||||
#else
|
|
||||||
#ifdef LIBXML_HTML_ENABLED
|
|
||||||
if (html)
|
|
||||||
doc = htmlParseFile(argv[i], NULL);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
doc = xmlParseFile(argv[i]);
|
|
||||||
#endif
|
|
||||||
if (doc == NULL) {
|
if (doc == NULL) {
|
||||||
fprintf(stderr, "unable to parse %s\n", argv[i]);
|
fprintf(stderr, "unable to parse %s\n", argv[i]);
|
||||||
errorno = 6;
|
errorno = 6;
|
||||||
|
Reference in New Issue
Block a user