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>
|
||||
|
||||
* configure.in python/Makefile.am python/tests/Makefile.am: applied
|
||||
|
@ -192,7 +192,11 @@ xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
||||
ret = ret->next;
|
||||
}
|
||||
|
||||
#ifdef XSLT_PARSE_OPTIONS
|
||||
doc = xmlReadFile((const char *) URI, NULL, XSLT_PARSE_OPTIONS);
|
||||
#else
|
||||
doc = xmlParseFile((const char *) URI);
|
||||
#endif
|
||||
if (doc == NULL)
|
||||
return(NULL);
|
||||
|
||||
@ -262,7 +266,11 @@ xsltLoadStyleDocument(xsltStylesheetPtr style, const xmlChar *URI) {
|
||||
ret = ret->next;
|
||||
}
|
||||
|
||||
#ifdef XSLT_PARSE_OPTIONS
|
||||
doc = xmlReadFile((const char *) URI, NULL, XSLT_PARSE_OPTIONS);
|
||||
#else
|
||||
doc = xmlParseFile((const char *) URI);
|
||||
#endif
|
||||
if (doc == 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) {
|
||||
xsltTransformError(NULL, style, cur,
|
||||
"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);
|
||||
#endif
|
||||
if (doc == NULL) {
|
||||
xsltTransformError(NULL, NULL, NULL,
|
||||
"xsltParseStylesheetFile : cannot parse %s\n", filename);
|
||||
@ -2254,6 +2258,14 @@ xsltLoadStylesheetPI(xmlDocPtr doc) {
|
||||
subtree = ID->parent;
|
||||
fake = xmlNewDoc(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);
|
||||
xmlAddChild((xmlNodePtr) fake, subtree);
|
||||
ret = xsltParseStylesheetDoc(fake);
|
||||
|
@ -44,6 +44,16 @@ extern "C" {
|
||||
*/
|
||||
#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:
|
||||
*
|
||||
|
@ -17,6 +17,7 @@
|
||||
<META content="TFI Technology" name="DC.Contributors">
|
||||
<SCRIPT language="JavaScript">
|
||||
|
||||
|
||||
if (document.images)
|
||||
{
|
||||
var imgBannerPreload = new Image();
|
||||
@ -76,6 +77,7 @@ function inact(imgName)
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
</SCRIPT>
|
||||
</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>
|
||||
|
@ -1,17 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<new-fruit1 type="apples">
|
||||
<![CDATA[
|
||||
<new-fruit1 type="apples"><![CDATA[
|
||||
The site is at
|
||||
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
|
||||
]]></new-fruit2>
|
||||
<new-fruit1 type="pears">
|
||||
<![CDATA[
|
||||
<new-fruit1 type="pears"><![CDATA[
|
||||
The site is at
|
||||
http://www.pears.com/index.html]]>
|
||||
</new-fruit1><new-fruit2 type="pears"><![CDATA[
|
||||
http://www.pears.com/index.html]]></new-fruit1><new-fruit2 type="pears"><![CDATA[
|
||||
The site is at http://www.pears.com/index.html]]></new-fruit2>
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
#include <libxml/catalog.h>
|
||||
#endif
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/uri.h>
|
||||
|
||||
@ -103,6 +104,9 @@ static int profile = 0;
|
||||
#define MAX_PARAMETERS 64
|
||||
#define MAX_PATHS 64
|
||||
|
||||
#if LIBXML_VERSION >= 20600
|
||||
static int options = XSLT_PARSE_OPTIONS;
|
||||
#endif
|
||||
static const char *params[MAX_PARAMETERS + 1];
|
||||
static int nbparams = 0;
|
||||
static xmlChar *strparams[MAX_PARAMETERS + 1];
|
||||
@ -386,12 +390,21 @@ xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur, const char *filename) {
|
||||
res = xsltApplyStylesheet(cur, doc, params);
|
||||
xmlFreeDoc(res);
|
||||
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
|
||||
if (html)
|
||||
doc = htmlParseFile(filename, NULL);
|
||||
else
|
||||
#endif
|
||||
doc = xmlParseFile(filename);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
ctxt = xsltNewTransformContext(cur, doc);
|
||||
@ -539,7 +552,6 @@ main(int argc, char **argv)
|
||||
|
||||
LIBXML_TEST_VERSION
|
||||
|
||||
xmlLineNumbersDefault(1);
|
||||
sec = xsltNewSecurityPrefs();
|
||||
xsltSetDefaultSecurityPrefs(sec);
|
||||
defaultEntityLoader = xmlGetExternalEntityLoader();
|
||||
@ -723,16 +735,17 @@ main(int argc, char **argv)
|
||||
}
|
||||
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;
|
||||
|
||||
|
||||
/*
|
||||
* Replace entities with their content.
|
||||
*/
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
xmlLineNumbersDefault(1);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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 (timing)
|
||||
startTimer();
|
||||
#if LIBXML_VERSION >= 20600
|
||||
style = xmlReadFile((const char *) argv[i], NULL, options);
|
||||
#else
|
||||
style = xmlParseFile((const char *) argv[i]);
|
||||
#endif
|
||||
if (timing)
|
||||
endTimer("Parsing stylesheet %s", argv[i]);
|
||||
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
|
||||
*/
|
||||
xmlDefaultSAXHandlerInit();
|
||||
xmlDefaultSAXHandler.cdataBlock = NULL;
|
||||
#endif
|
||||
|
||||
if ((cur != NULL) && (cur->errors == 0)) {
|
||||
for (; i < argc; i++) {
|
||||
doc = NULL;
|
||||
if (timing)
|
||||
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
|
||||
if (html)
|
||||
doc = htmlParseFile(argv[i], NULL);
|
||||
else
|
||||
#endif
|
||||
doc = xmlParseFile(argv[i]);
|
||||
#endif
|
||||
if (doc == NULL) {
|
||||
fprintf(stderr, "unable to parse %s\n", argv[i]);
|
||||
errorno = 6;
|
||||
|
Reference in New Issue
Block a user