mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
Bugfixes, extesion and optimizations for XSLT:
- xpath.c: removed an error found by XSLT usage - tree.c parserInternals.h: use a predefined static string for text and comment nodes, avoid freeing them in xmlFreeNode, exported the string name in parserInternals.h and added another value to disable encoding at output (for XSLT), gain memory, time. Daniel
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
Thu Jan 18 13:11:50 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
|
* xpath.c: removed an error found by XSLT usage
|
||||||
|
* tree.c parserInternals.h: use a predefined static string
|
||||||
|
for text and comment nodes, avoid freeing them in xmlFreeNode,
|
||||||
|
exported the string name in parserInternals.h and added
|
||||||
|
another value to disable encoding at output (for XSLT),
|
||||||
|
gain memory, time.
|
||||||
|
|
||||||
Wed Jan 17 09:15:16 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
Wed Jan 17 09:15:16 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
* win32/README.MSDev win32/libxml2/libxml2_a.dsp
|
* win32/README.MSDev win32/libxml2/libxml2_a.dsp
|
||||||
|
15
configure.in
15
configure.in
@ -221,6 +221,21 @@ LDFLAGS=${_ldflags}
|
|||||||
|
|
||||||
AC_SUBST(RDL_LIBS)
|
AC_SUBST(RDL_LIBS)
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl specific tests to setup DV's devel environment with debug etc ...
|
||||||
|
dnl
|
||||||
|
if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ; then
|
||||||
|
if test "${with_mem_debug}" = "" ; then
|
||||||
|
with_mem_debug="yes"
|
||||||
|
fi
|
||||||
|
dnl if test "${with_docbook}" = "" ; then
|
||||||
|
dnl with_docbook="yes"
|
||||||
|
dnl fi
|
||||||
|
if test "${with_xptr}" = "" ; then
|
||||||
|
with_xptr="yes"
|
||||||
|
fi
|
||||||
|
CFLAGS="-Wall -g -pedantic"
|
||||||
|
fi
|
||||||
dnl
|
dnl
|
||||||
dnl Aloow to disable various pieces
|
dnl Aloow to disable various pieces
|
||||||
dnl
|
dnl
|
||||||
|
@ -112,6 +112,9 @@ LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
|
|||||||
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
|
||||||
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
|
||||||
LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
|
||||||
|
LIBXML_DLL_IMPORT extern xmlChar xmlStringText[];
|
||||||
|
LIBXML_DLL_IMPORT extern xmlChar xmlStringTextNoenc[];
|
||||||
|
LIBXML_DLL_IMPORT extern xmlChar xmlStringComment[];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function to finish teh work of the macros where needed
|
* Function to finish teh work of the macros where needed
|
||||||
|
@ -112,6 +112,9 @@ LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
|
|||||||
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
|
||||||
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
|
||||||
LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
|
||||||
|
LIBXML_DLL_IMPORT extern xmlChar xmlStringText[];
|
||||||
|
LIBXML_DLL_IMPORT extern xmlChar xmlStringTextNoenc[];
|
||||||
|
LIBXML_DLL_IMPORT extern xmlChar xmlStringComment[];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function to finish teh work of the macros where needed
|
* Function to finish teh work of the macros where needed
|
||||||
|
44
tree.c
44
tree.c
@ -37,8 +37,10 @@
|
|||||||
#include <libxml/valid.h>
|
#include <libxml/valid.h>
|
||||||
#include <libxml/xmlerror.h>
|
#include <libxml/xmlerror.h>
|
||||||
|
|
||||||
static xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
|
xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
|
||||||
static xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
|
xmlChar xmlStringTextNoenc[] =
|
||||||
|
{ 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 };
|
||||||
|
xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
|
||||||
int oldXMLWDcompatibility = 0;
|
int oldXMLWDcompatibility = 0;
|
||||||
int xmlIndentTreeOutput = 0;
|
int xmlIndentTreeOutput = 0;
|
||||||
xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
|
xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
|
||||||
@ -1347,7 +1349,7 @@ xmlNewText(const xmlChar *content) {
|
|||||||
memset(cur, 0, sizeof(xmlNode));
|
memset(cur, 0, sizeof(xmlNode));
|
||||||
cur->type = XML_TEXT_NODE;
|
cur->type = XML_TEXT_NODE;
|
||||||
|
|
||||||
cur->name = xmlStrdup(xmlStringText);
|
cur->name = xmlStringText;
|
||||||
if (content != NULL) {
|
if (content != NULL) {
|
||||||
#ifndef XML_USE_BUFFER_CONTENT
|
#ifndef XML_USE_BUFFER_CONTENT
|
||||||
cur->content = xmlStrdup(content);
|
cur->content = xmlStrdup(content);
|
||||||
@ -1566,7 +1568,7 @@ xmlNewTextLen(const xmlChar *content, int len) {
|
|||||||
memset(cur, 0, sizeof(xmlNode));
|
memset(cur, 0, sizeof(xmlNode));
|
||||||
cur->type = XML_TEXT_NODE;
|
cur->type = XML_TEXT_NODE;
|
||||||
|
|
||||||
cur->name = xmlStrdup(xmlStringText);
|
cur->name = xmlStringText;
|
||||||
if (content != NULL) {
|
if (content != NULL) {
|
||||||
#ifndef XML_USE_BUFFER_CONTENT
|
#ifndef XML_USE_BUFFER_CONTENT
|
||||||
cur->content = xmlStrndup(content, len);
|
cur->content = xmlStrndup(content, len);
|
||||||
@ -1622,7 +1624,7 @@ xmlNewComment(const xmlChar *content) {
|
|||||||
memset(cur, 0, sizeof(xmlNode));
|
memset(cur, 0, sizeof(xmlNode));
|
||||||
cur->type = XML_COMMENT_NODE;
|
cur->type = XML_COMMENT_NODE;
|
||||||
|
|
||||||
cur->name = xmlStrdup(xmlStringComment);
|
cur->name = xmlStringComment;
|
||||||
if (content != NULL) {
|
if (content != NULL) {
|
||||||
#ifndef XML_USE_BUFFER_CONTENT
|
#ifndef XML_USE_BUFFER_CONTENT
|
||||||
cur->content = xmlStrdup(content);
|
cur->content = xmlStrdup(content);
|
||||||
@ -2286,7 +2288,11 @@ xmlFreeNode(xmlNodePtr cur) {
|
|||||||
#else
|
#else
|
||||||
if (cur->content != NULL) xmlBufferFree(cur->content);
|
if (cur->content != NULL) xmlBufferFree(cur->content);
|
||||||
#endif
|
#endif
|
||||||
if (cur->name != NULL) xmlFree((char *) cur->name);
|
if ((cur->name != NULL) &&
|
||||||
|
(cur->name != xmlStringText) &&
|
||||||
|
(cur->name != xmlStringTextNoenc) &&
|
||||||
|
(cur->name != xmlStringComment))
|
||||||
|
xmlFree((char *) cur->name);
|
||||||
if (cur->nsDef != NULL) xmlFreeNsList(cur->nsDef);
|
if (cur->nsDef != NULL) xmlFreeNsList(cur->nsDef);
|
||||||
memset(cur, -1, sizeof(xmlNode));
|
memset(cur, -1, sizeof(xmlNode));
|
||||||
xmlFree(cur);
|
xmlFree(cur);
|
||||||
@ -5006,17 +5012,29 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
|
|||||||
}
|
}
|
||||||
if (cur->type == XML_TEXT_NODE) {
|
if (cur->type == XML_TEXT_NODE) {
|
||||||
if (cur->content != NULL) {
|
if (cur->content != NULL) {
|
||||||
xmlChar *buffer;
|
if ((cur->name == xmlStringText) ||
|
||||||
|
(cur->name != xmlStringTextNoenc)) {
|
||||||
|
xmlChar *buffer;
|
||||||
|
|
||||||
#ifndef XML_USE_BUFFER_CONTENT
|
#ifndef XML_USE_BUFFER_CONTENT
|
||||||
buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
|
buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
|
||||||
#else
|
#else
|
||||||
buffer = xmlEncodeEntitiesReentrant(doc,
|
buffer = xmlEncodeEntitiesReentrant(doc,
|
||||||
xmlBufferContent(cur->content));
|
xmlBufferContent(cur->content));
|
||||||
|
#endif
|
||||||
|
if (buffer != NULL) {
|
||||||
|
xmlBufferWriteCHAR(buf, buffer);
|
||||||
|
xmlFree(buffer);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Disable escaping, needed for XSLT
|
||||||
|
*/
|
||||||
|
#ifndef XML_USE_BUFFER_CONTENT
|
||||||
|
xmlBufferWriteCHAR(buf, cur->content);
|
||||||
|
#else
|
||||||
|
xmlBufferWriteCHAR(buf, xmlBufferContent(cur->content));
|
||||||
#endif
|
#endif
|
||||||
if (buffer != NULL) {
|
|
||||||
xmlBufferWriteCHAR(buf, buffer);
|
|
||||||
xmlFree(buffer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
5
xpath.c
5
xpath.c
@ -4326,7 +4326,7 @@ xmlXPathParseQName(xmlXPathParserContextPtr ctxt, xmlChar **prefix) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlXPathParseName:
|
* xmlXPathParseName:
|
||||||
* @ctxt: the XPointer Parser context
|
* @ctxt: the XPath Parser context
|
||||||
*
|
*
|
||||||
* parse an XML name
|
* parse an XML name
|
||||||
*
|
*
|
||||||
@ -4863,7 +4863,8 @@ xmlXPathEvalPathExpr(xmlXPathParserContextPtr ctxt) {
|
|||||||
lc = 1;
|
lc = 1;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
XP_ERROR(XPATH_EXPR_ERROR);
|
lc = 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user