mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-07-29 15:41:13 +03:00
switch to use xmlReadfile instead of xmlParseFile, this avoid relying on
* libxslt/documents.c libxslt/imports.c libxslt/xslt.c libxslt/xslt.h xsltproc/xsltproc.c: switch to use xmlReadfile instead of xmlParseFile, this avoid relying on global parser options, far far cleaner. * tests/XSLTMark/xslbench1.out tests/general/bug-90.out: fixes a slightly corrected output for CDATA and STYLE element save. Daniel
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
Fri Oct 31 15:53:45 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* libxslt/documents.c libxslt/imports.c libxslt/xslt.c libxslt/xslt.h
|
||||||
|
xsltproc/xsltproc.c: switch to use xmlReadfile instead of
|
||||||
|
xmlParseFile, this avoid relying on global parser options, far
|
||||||
|
far cleaner.
|
||||||
|
* tests/XSLTMark/xslbench1.out tests/general/bug-90.out: fixes a
|
||||||
|
slightly corrected output for CDATA and STYLE element save.
|
||||||
|
|
||||||
Tue Oct 28 15:30:54 CET 2003 Daniel Veillard <daniel@veillard.com>
|
Tue Oct 28 15:30:54 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* configure.in python/Makefile.am python/tests/Makefile.am: applied
|
* configure.in python/Makefile.am python/tests/Makefile.am: applied
|
||||||
|
@ -192,7 +192,11 @@ xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
|||||||
ret = ret->next;
|
ret = ret->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XSLT_PARSE_OPTIONS
|
||||||
|
doc = xmlReadFile((const char *) URI, NULL, XSLT_PARSE_OPTIONS);
|
||||||
|
#else
|
||||||
doc = xmlParseFile((const char *) URI);
|
doc = xmlParseFile((const char *) URI);
|
||||||
|
#endif
|
||||||
if (doc == NULL)
|
if (doc == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
@ -262,7 +266,11 @@ xsltLoadStyleDocument(xsltStylesheetPtr style, const xmlChar *URI) {
|
|||||||
ret = ret->next;
|
ret = ret->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XSLT_PARSE_OPTIONS
|
||||||
|
doc = xmlReadFile((const char *) URI, NULL, XSLT_PARSE_OPTIONS);
|
||||||
|
#else
|
||||||
doc = xmlParseFile((const char *) URI);
|
doc = xmlParseFile((const char *) URI);
|
||||||
|
#endif
|
||||||
if (doc == NULL)
|
if (doc == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
|
@ -107,7 +107,11 @@ xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
import = xmlParseFile((const char *)URI);
|
#ifdef XSLT_PARSE_OPTIONS
|
||||||
|
import = xmlReadFile((const char *) URI, NULL, XSLT_PARSE_OPTIONS);
|
||||||
|
#else
|
||||||
|
import = xmlParseFile((const char *) URI);
|
||||||
|
#endif
|
||||||
if (import == NULL) {
|
if (import == NULL) {
|
||||||
xsltTransformError(NULL, style, cur,
|
xsltTransformError(NULL, style, cur,
|
||||||
"xsl:import : unable to load %s\n", URI);
|
"xsl:import : unable to load %s\n", URI);
|
||||||
|
@ -2059,7 +2059,11 @@ xsltParseStylesheetFile(const xmlChar* filename) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XSLT_PARSE_OPTIONS
|
||||||
|
doc = xmlReadFile((const char *) filename, NULL, XSLT_PARSE_OPTIONS);
|
||||||
|
#else
|
||||||
doc = xmlParseFile((const char *) filename);
|
doc = xmlParseFile((const char *) filename);
|
||||||
|
#endif
|
||||||
if (doc == NULL) {
|
if (doc == NULL) {
|
||||||
xsltTransformError(NULL, NULL, NULL,
|
xsltTransformError(NULL, NULL, NULL,
|
||||||
"xsltParseStylesheetFile : cannot parse %s\n", filename);
|
"xsltParseStylesheetFile : cannot parse %s\n", filename);
|
||||||
@ -2254,6 +2258,14 @@ xsltLoadStylesheetPI(xmlDocPtr doc) {
|
|||||||
subtree = ID->parent;
|
subtree = ID->parent;
|
||||||
fake = xmlNewDoc(NULL);
|
fake = xmlNewDoc(NULL);
|
||||||
if (fake != NULL) {
|
if (fake != NULL) {
|
||||||
|
#if LIBXML_VERSION >= 20600
|
||||||
|
/*
|
||||||
|
* the dictionnary should be shared since nodes are
|
||||||
|
* moved over.
|
||||||
|
*/
|
||||||
|
fake->dict = doc->dict;
|
||||||
|
xmlDictReference(doc->dict);
|
||||||
|
#endif
|
||||||
xmlUnlinkNode(subtree);
|
xmlUnlinkNode(subtree);
|
||||||
xmlAddChild((xmlNodePtr) fake, subtree);
|
xmlAddChild((xmlNodePtr) fake, subtree);
|
||||||
ret = xsltParseStylesheetDoc(fake);
|
ret = xsltParseStylesheetDoc(fake);
|
||||||
|
@ -44,6 +44,16 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define XSLT_NAMESPACE ((xmlChar *) "http://www.w3.org/1999/XSL/Transform")
|
#define XSLT_NAMESPACE ((xmlChar *) "http://www.w3.org/1999/XSL/Transform")
|
||||||
|
|
||||||
|
#if LIBXML_VERSION >= 20600
|
||||||
|
/**
|
||||||
|
* XSLT_PARSE_OPTIONS:
|
||||||
|
*
|
||||||
|
* The set of options to pass to an xmlReadxxx when loading files for
|
||||||
|
* XSLT consumption.
|
||||||
|
*/
|
||||||
|
#define XSLT_PARSE_OPTIONS \
|
||||||
|
XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_NOCDATA
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* xsltMaxDepth:
|
* xsltMaxDepth:
|
||||||
*
|
*
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
<META content="TFI Technology Ltd Home of StayAlive, the premier crash protection software." name="DC.Description">
|
<META content="TFI Technology Ltd Home of StayAlive, the premier crash protection software." name="DC.Description">
|
||||||
<META content="TFI Technology" name="DC.Publisher">
|
<META content="TFI Technology" name="DC.Publisher">
|
||||||
<META content="TFI Technology" name="DC.Contributors">
|
<META content="TFI Technology" name="DC.Contributors">
|
||||||
<SCRIPT language="JavaScript">
|
<SCRIPT language="JavaScript">
|
||||||
|
|
||||||
|
|
||||||
if (document.images)
|
if (document.images)
|
||||||
{
|
{
|
||||||
@ -76,6 +77,7 @@ function inact(imgName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
</SCRIPT>
|
</SCRIPT>
|
||||||
</HEAD>
|
</HEAD>
|
||||||
<BODY background="TFI Technology Products_files/WaterMark.gif" bgColor="#ffffff" bgProperties="fixed"><TABLE border="0" cellPadding="0" cellSpacing="0" height="516" width="125"><TBODY>
|
<BODY background="TFI Technology Products_files/WaterMark.gif" bgColor="#ffffff" bgProperties="fixed"><TABLE border="0" cellPadding="0" cellSpacing="0" height="516" width="125"><TBODY>
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<new-fruit1 type="apples">
|
<new-fruit1 type="apples"><![CDATA[
|
||||||
<![CDATA[
|
|
||||||
The site is at
|
The site is at
|
||||||
http://www.apples.com/site?args&stuff
|
http://www.apples.com/site?args&stuff
|
||||||
]]>
|
]]></new-fruit1><new-fruit2 type="apples"><![CDATA[
|
||||||
</new-fruit1><new-fruit2 type="apples"><![CDATA[
|
|
||||||
The site is at http://www.apples.com/site?args&stuff
|
The site is at http://www.apples.com/site?args&stuff
|
||||||
]]></new-fruit2>
|
]]></new-fruit2>
|
||||||
<new-fruit1 type="pears">
|
<new-fruit1 type="pears"><![CDATA[
|
||||||
<![CDATA[
|
|
||||||
The site is at
|
The site is at
|
||||||
http://www.pears.com/index.html]]>
|
http://www.pears.com/index.html]]></new-fruit1><new-fruit2 type="pears"><![CDATA[
|
||||||
</new-fruit1><new-fruit2 type="pears"><![CDATA[
|
|
||||||
The site is at http://www.pears.com/index.html]]></new-fruit2>
|
The site is at http://www.pears.com/index.html]]></new-fruit2>
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#ifdef LIBXML_CATALOG_ENABLED
|
#ifdef LIBXML_CATALOG_ENABLED
|
||||||
#include <libxml/catalog.h>
|
#include <libxml/catalog.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <libxml/parser.h>
|
||||||
#include <libxml/parserInternals.h>
|
#include <libxml/parserInternals.h>
|
||||||
#include <libxml/uri.h>
|
#include <libxml/uri.h>
|
||||||
|
|
||||||
@ -103,6 +104,9 @@ 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;
|
||||||
|
#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];
|
||||||
@ -386,12 +390,21 @@ 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
|
||||||
|
if (html)
|
||||||
|
doc = htmlReadFile(filename, NULL, options);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
doc = xmlReadFile(filename, NULL, options);
|
||||||
|
#else
|
||||||
#ifdef LIBXML_HTML_ENABLED
|
#ifdef LIBXML_HTML_ENABLED
|
||||||
if (html)
|
if (html)
|
||||||
doc = htmlParseFile(filename, NULL);
|
doc = htmlParseFile(filename, NULL);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
doc = xmlParseFile(filename);
|
doc = xmlParseFile(filename);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctxt = xsltNewTransformContext(cur, doc);
|
ctxt = xsltNewTransformContext(cur, doc);
|
||||||
@ -539,7 +552,6 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
LIBXML_TEST_VERSION
|
LIBXML_TEST_VERSION
|
||||||
|
|
||||||
xmlLineNumbersDefault(1);
|
|
||||||
sec = xsltNewSecurityPrefs();
|
sec = xsltNewSecurityPrefs();
|
||||||
xsltSetDefaultSecurityPrefs(sec);
|
xsltSetDefaultSecurityPrefs(sec);
|
||||||
defaultEntityLoader = xmlGetExternalEntityLoader();
|
defaultEntityLoader = xmlGetExternalEntityLoader();
|
||||||
@ -723,16 +735,17 @@ 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)
|
if (novalid == 0)
|
||||||
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
||||||
else
|
else
|
||||||
xmlLoadExtDtdDefaultValue = 0;
|
xmlLoadExtDtdDefaultValue = 0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Replace entities with their content.
|
|
||||||
*/
|
|
||||||
xmlSubstituteEntitiesDefault(1);
|
xmlSubstituteEntitiesDefault(1);
|
||||||
|
xmlLineNumbersDefault(1);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register the EXSLT extensions and the test module
|
* Register the EXSLT extensions and the test module
|
||||||
@ -780,7 +793,11 @@ 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);
|
||||||
|
#else
|
||||||
style = xmlParseFile((const char *) argv[i]);
|
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) {
|
||||||
@ -814,23 +831,35 @@ 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
|
* disable CDATA from being built in the document tree
|
||||||
*/
|
*/
|
||||||
xmlDefaultSAXHandlerInit();
|
xmlDefaultSAXHandlerInit();
|
||||||
xmlDefaultSAXHandler.cdataBlock = NULL;
|
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
|
||||||
|
if (html)
|
||||||
|
doc = htmlReadFile(argv[i], NULL, options);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
doc = xmlReadFile(argv[i], NULL, options);
|
||||||
|
#else
|
||||||
#ifdef LIBXML_HTML_ENABLED
|
#ifdef LIBXML_HTML_ENABLED
|
||||||
if (html)
|
if (html)
|
||||||
doc = htmlParseFile(argv[i], NULL);
|
doc = htmlParseFile(argv[i], NULL);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
doc = xmlParseFile(argv[i]);
|
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