1
0
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:
Daniel Veillard
2001-01-18 12:17:12 +00:00
parent ccc86a75a8
commit f6eea27b38
6 changed files with 64 additions and 15 deletions

View File

@ -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>
* win32/README.MSDev win32/libxml2/libxml2_a.dsp

View File

@ -221,6 +221,21 @@ LDFLAGS=${_ldflags}
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 Aloow to disable various pieces
dnl

View File

@ -112,6 +112,9 @@ LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
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

View File

@ -112,6 +112,9 @@ LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
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

30
tree.c
View File

@ -37,8 +37,10 @@
#include <libxml/valid.h>
#include <libxml/xmlerror.h>
static xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
static xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
xmlChar xmlStringText[] = { 't', 'e', 'x', '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 xmlIndentTreeOutput = 0;
xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
@ -1347,7 +1349,7 @@ xmlNewText(const xmlChar *content) {
memset(cur, 0, sizeof(xmlNode));
cur->type = XML_TEXT_NODE;
cur->name = xmlStrdup(xmlStringText);
cur->name = xmlStringText;
if (content != NULL) {
#ifndef XML_USE_BUFFER_CONTENT
cur->content = xmlStrdup(content);
@ -1566,7 +1568,7 @@ xmlNewTextLen(const xmlChar *content, int len) {
memset(cur, 0, sizeof(xmlNode));
cur->type = XML_TEXT_NODE;
cur->name = xmlStrdup(xmlStringText);
cur->name = xmlStringText;
if (content != NULL) {
#ifndef XML_USE_BUFFER_CONTENT
cur->content = xmlStrndup(content, len);
@ -1622,7 +1624,7 @@ xmlNewComment(const xmlChar *content) {
memset(cur, 0, sizeof(xmlNode));
cur->type = XML_COMMENT_NODE;
cur->name = xmlStrdup(xmlStringComment);
cur->name = xmlStringComment;
if (content != NULL) {
#ifndef XML_USE_BUFFER_CONTENT
cur->content = xmlStrdup(content);
@ -2286,7 +2288,11 @@ xmlFreeNode(xmlNodePtr cur) {
#else
if (cur->content != NULL) xmlBufferFree(cur->content);
#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);
memset(cur, -1, sizeof(xmlNode));
xmlFree(cur);
@ -5006,6 +5012,8 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
}
if (cur->type == XML_TEXT_NODE) {
if (cur->content != NULL) {
if ((cur->name == xmlStringText) ||
(cur->name != xmlStringTextNoenc)) {
xmlChar *buffer;
#ifndef XML_USE_BUFFER_CONTENT
@ -5018,6 +5026,16 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
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
}
}
return;
}

View File

@ -4326,7 +4326,7 @@ xmlXPathParseQName(xmlXPathParserContextPtr ctxt, xmlChar **prefix) {
/**
* xmlXPathParseName:
* @ctxt: the XPointer Parser context
* @ctxt: the XPath Parser context
*
* parse an XML name
*
@ -4863,7 +4863,8 @@ xmlXPathEvalPathExpr(xmlXPathParserContextPtr ctxt) {
lc = 1;
break;
} else {
XP_ERROR(XPATH_EXPR_ERROR);
lc = 1;
break;
}
len++;
}