Commit f6eea27b authored by Daniel Veillard's avatar Daniel Veillard
Browse files

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
parent ccc86a75
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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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,17 +5012,29 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
}
if (cur->type == XML_TEXT_NODE) {
if (cur->content != NULL) {
xmlChar *buffer;
if ((cur->name == xmlStringText) ||
(cur->name != xmlStringTextNoenc)) {
xmlChar *buffer;
#ifndef XML_USE_BUFFER_CONTENT
buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
#else
buffer = xmlEncodeEntitiesReentrant(doc,
xmlBufferContent(cur->content));
buffer = xmlEncodeEntitiesReentrant(doc,
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
if (buffer != NULL) {
xmlBufferWriteCHAR(buf, buffer);
xmlFree(buffer);
}
}
return;
......
......@@ -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++;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment