mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
Bug fixes and an extension found and required by XSLT:
- xpath.c: bug fixes found from XSLT - tree.c: preserve node->name special values when copying nodes. - parserInternals.[ch] parser.[ch] SAX.c : added a mode where external subset are fetched when available but without full validation. Added xmlLoadExtDtdDefaultValue, need a function. - HTMLtree.c: add support for xmlStringTextNoenc for XSLt HTML output with encoding disabled. Daniel
This commit is contained in:
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Mon Feb 5 18:51:36 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
|
* xpath.c: bug fixes found from XSLT
|
||||||
|
* tree.c: preserve node->name special values when copying nodes.
|
||||||
|
* parserInternals.[ch] parser.[ch] SAX.c : added a mode where
|
||||||
|
external subset are fetched when available but without full
|
||||||
|
validation. Added xmlLoadExtDtdDefaultValue, need a function.
|
||||||
|
* HTMLtree.c: add support for xmlStringTextNoenc for XSLt HTML
|
||||||
|
output with encoding disabled.
|
||||||
|
|
||||||
Sat Feb 3 09:50:29 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
Sat Feb 3 09:50:29 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
* xmliO.c: Harry Blundell pointed out that xmlCheckFilename
|
* xmliO.c: Harry Blundell pointed out that xmlCheckFilename
|
||||||
|
39
HTMLtree.c
39
HTMLtree.c
@ -32,6 +32,7 @@
|
|||||||
#include <libxml/entities.h>
|
#include <libxml/entities.h>
|
||||||
#include <libxml/valid.h>
|
#include <libxml/valid.h>
|
||||||
#include <libxml/xmlerror.h>
|
#include <libxml/xmlerror.h>
|
||||||
|
#include <libxml/parserInternals.h>
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
@ -460,17 +461,22 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
|
|||||||
}
|
}
|
||||||
if (cur->type == HTML_TEXT_NODE) {
|
if (cur->type == HTML_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
|
#endif
|
||||||
if (buffer != NULL) {
|
if (buffer != NULL) {
|
||||||
xmlBufferWriteCHAR(buf, buffer);
|
xmlBufferWriteCHAR(buf, buffer);
|
||||||
xmlFree(buffer);
|
xmlFree(buffer);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xmlBufferWriteCHAR(buf, cur->content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -794,17 +800,22 @@ htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, const
|
|||||||
}
|
}
|
||||||
if (cur->type == HTML_TEXT_NODE) {
|
if (cur->type == HTML_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
|
#endif
|
||||||
if (buffer != NULL) {
|
if (buffer != NULL) {
|
||||||
xmlOutputBufferWriteString(buf, (const char *)buffer);
|
xmlOutputBufferWriteString(buf, (const char *)buffer);
|
||||||
xmlFree(buffer);
|
xmlFree(buffer);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xmlOutputBufferWriteString(buf, (const char *)cur->content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
3
SAX.c
3
SAX.c
@ -200,7 +200,8 @@ externalSubset(void *ctx, const xmlChar *name,
|
|||||||
name, ExternalID, SystemID);
|
name, ExternalID, SystemID);
|
||||||
#endif
|
#endif
|
||||||
if (((ExternalID != NULL) || (SystemID != NULL)) &&
|
if (((ExternalID != NULL) || (SystemID != NULL)) &&
|
||||||
(ctxt->validate && ctxt->wellFormed && ctxt->myDoc)) {
|
(((ctxt->validate) || (ctxt->loadsubset)) &&
|
||||||
|
(ctxt->wellFormed && ctxt->myDoc))) {
|
||||||
/*
|
/*
|
||||||
* Try to fetch and parse the external subset.
|
* Try to fetch and parse the external subset.
|
||||||
*/
|
*/
|
||||||
|
@ -185,6 +185,8 @@ struct _xmlParserCtxt {
|
|||||||
int nodemem; /* Speed up large node parsing */
|
int nodemem; /* Speed up large node parsing */
|
||||||
int pedantic; /* signal pedantic warnings */
|
int pedantic; /* signal pedantic warnings */
|
||||||
void *_private; /* For user data, libxml won't touch it */
|
void *_private; /* For user data, libxml won't touch it */
|
||||||
|
|
||||||
|
int loadsubset; /* should the external subset be loaded */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,6 +110,7 @@ LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
|
|||||||
LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
|
LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
|
||||||
LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
|
||||||
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
|
||||||
|
LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
|
||||||
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 xmlStringText[];
|
||||||
|
5
parser.c
5
parser.c
@ -92,6 +92,7 @@ int xmlDoValidityCheckingDefaultVal = 0;
|
|||||||
int xmlSubstituteEntitiesDefaultValue = 0;
|
int xmlSubstituteEntitiesDefaultValue = 0;
|
||||||
int xmlDoValidityCheckingDefaultValue = 0;
|
int xmlDoValidityCheckingDefaultValue = 0;
|
||||||
#endif
|
#endif
|
||||||
|
int xmlLoadExtDtdDefaultValue = 0;
|
||||||
int xmlPedanticParserDefaultValue = 0;
|
int xmlPedanticParserDefaultValue = 0;
|
||||||
int xmlKeepBlanksDefaultValue = 1;
|
int xmlKeepBlanksDefaultValue = 1;
|
||||||
|
|
||||||
@ -7211,6 +7212,7 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) {
|
|||||||
*/
|
*/
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
ctxt->instate = XML_PARSER_CONTENT;
|
||||||
ctxt->validate = 0;
|
ctxt->validate = 0;
|
||||||
|
ctxt->loadsubset = 0;
|
||||||
ctxt->depth = 0;
|
ctxt->depth = 0;
|
||||||
|
|
||||||
xmlParseContent(ctxt);
|
xmlParseContent(ctxt);
|
||||||
@ -8750,6 +8752,7 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
|
|||||||
*/
|
*/
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
ctxt->instate = XML_PARSER_CONTENT;
|
||||||
ctxt->validate = ctx->validate;
|
ctxt->validate = ctx->validate;
|
||||||
|
ctxt->loadsubset = ctx->loadsubset;
|
||||||
ctxt->depth = ctx->depth + 1;
|
ctxt->depth = ctx->depth + 1;
|
||||||
ctxt->replaceEntities = ctx->replaceEntities;
|
ctxt->replaceEntities = ctx->replaceEntities;
|
||||||
if (ctxt->validate) {
|
if (ctxt->validate) {
|
||||||
@ -8927,6 +8930,7 @@ xmlParseExternalEntity(xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data,
|
|||||||
*/
|
*/
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
ctxt->instate = XML_PARSER_CONTENT;
|
||||||
ctxt->validate = 0;
|
ctxt->validate = 0;
|
||||||
|
ctxt->loadsubset = 0;
|
||||||
ctxt->depth = depth;
|
ctxt->depth = depth;
|
||||||
|
|
||||||
xmlParseContent(ctxt);
|
xmlParseContent(ctxt);
|
||||||
@ -9071,6 +9075,7 @@ xmlParseBalancedChunkMemory(xmlDocPtr doc, xmlSAXHandlerPtr sax,
|
|||||||
* Doing validity checking on chunk doesn't make sense
|
* Doing validity checking on chunk doesn't make sense
|
||||||
*/
|
*/
|
||||||
ctxt->validate = 0;
|
ctxt->validate = 0;
|
||||||
|
ctxt->loadsubset = 0;
|
||||||
|
|
||||||
xmlParseContent(ctxt);
|
xmlParseContent(ctxt);
|
||||||
|
|
||||||
|
2
parser.h
2
parser.h
@ -185,6 +185,8 @@ struct _xmlParserCtxt {
|
|||||||
int nodemem; /* Speed up large node parsing */
|
int nodemem; /* Speed up large node parsing */
|
||||||
int pedantic; /* signal pedantic warnings */
|
int pedantic; /* signal pedantic warnings */
|
||||||
void *_private; /* For user data, libxml won't touch it */
|
void *_private; /* For user data, libxml won't touch it */
|
||||||
|
|
||||||
|
int loadsubset; /* should the external subset be loaded */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,6 +83,7 @@ xmlCheckVersion(int version) {
|
|||||||
|
|
||||||
const char *xmlFeaturesList[] = {
|
const char *xmlFeaturesList[] = {
|
||||||
"validate",
|
"validate",
|
||||||
|
"load subset",
|
||||||
"keep blanks",
|
"keep blanks",
|
||||||
"disable SAX",
|
"disable SAX",
|
||||||
"fetch external entities",
|
"fetch external entities",
|
||||||
@ -174,7 +175,7 @@ xmlGetFeature(xmlParserCtxtPtr ctxt, const char *name, void *result) {
|
|||||||
} else if (!strcmp(name, "disable SAX")) {
|
} else if (!strcmp(name, "disable SAX")) {
|
||||||
*((int *) result) = ctxt->disableSAX;
|
*((int *) result) = ctxt->disableSAX;
|
||||||
} else if (!strcmp(name, "fetch external entities")) {
|
} else if (!strcmp(name, "fetch external entities")) {
|
||||||
*((int *) result) = ctxt->validate;
|
*((int *) result) = ctxt->loadsubset;
|
||||||
} else if (!strcmp(name, "substitute entities")) {
|
} else if (!strcmp(name, "substitute entities")) {
|
||||||
*((int *) result) = ctxt->replaceEntities;
|
*((int *) result) = ctxt->replaceEntities;
|
||||||
} else if (!strcmp(name, "gather line info")) {
|
} else if (!strcmp(name, "gather line info")) {
|
||||||
@ -269,14 +270,8 @@ xmlSetFeature(xmlParserCtxtPtr ctxt, const char *name, void *value) {
|
|||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
if (!strcmp(name, "validate")) {
|
if (!strcmp(name, "validate")) {
|
||||||
ctxt->validate = *((int *) value);
|
int newvalidate = *((int *) value);
|
||||||
} else if (!strcmp(name, "keep blanks")) {
|
if ((!ctxt->validate) && (newvalidate != 0)) {
|
||||||
ctxt->keepBlanks = *((int *) value);
|
|
||||||
} else if (!strcmp(name, "disable SAX")) {
|
|
||||||
ctxt->disableSAX = *((int *) value);
|
|
||||||
} else if (!strcmp(name, "fetch external entities")) {
|
|
||||||
int newvalid = *((int *) value);
|
|
||||||
if ((!ctxt->validate) && (newvalid != 0)) {
|
|
||||||
if (ctxt->vctxt.warning == NULL)
|
if (ctxt->vctxt.warning == NULL)
|
||||||
ctxt->vctxt.warning = xmlParserValidityWarning;
|
ctxt->vctxt.warning = xmlParserValidityWarning;
|
||||||
if (ctxt->vctxt.error == NULL)
|
if (ctxt->vctxt.error == NULL)
|
||||||
@ -293,7 +288,13 @@ xmlSetFeature(xmlParserCtxtPtr ctxt, const char *name, void *value) {
|
|||||||
ctxt->vctxt.nodeMax = 4;
|
ctxt->vctxt.nodeMax = 4;
|
||||||
ctxt->vctxt.node = NULL;
|
ctxt->vctxt.node = NULL;
|
||||||
}
|
}
|
||||||
ctxt->validate = newvalid;
|
ctxt->validate = newvalidate;
|
||||||
|
} else if (!strcmp(name, "keep blanks")) {
|
||||||
|
ctxt->keepBlanks = *((int *) value);
|
||||||
|
} else if (!strcmp(name, "disable SAX")) {
|
||||||
|
ctxt->disableSAX = *((int *) value);
|
||||||
|
} else if (!strcmp(name, "fetch external entities")) {
|
||||||
|
ctxt->loadsubset = *((int *) value);
|
||||||
} else if (!strcmp(name, "substitute entities")) {
|
} else if (!strcmp(name, "substitute entities")) {
|
||||||
ctxt->replaceEntities = *((int *) value);
|
ctxt->replaceEntities = *((int *) value);
|
||||||
} else if (!strcmp(name, "gather line info")) {
|
} else if (!strcmp(name, "gather line info")) {
|
||||||
@ -2189,6 +2190,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
|
|||||||
ctxt->myDoc = NULL;
|
ctxt->myDoc = NULL;
|
||||||
ctxt->wellFormed = 1;
|
ctxt->wellFormed = 1;
|
||||||
ctxt->valid = 1;
|
ctxt->valid = 1;
|
||||||
|
ctxt->loadsubset = xmlLoadExtDtdDefaultValue;
|
||||||
ctxt->validate = xmlDoValidityCheckingDefaultValue;
|
ctxt->validate = xmlDoValidityCheckingDefaultValue;
|
||||||
ctxt->pedantic = xmlPedanticParserDefaultValue;
|
ctxt->pedantic = xmlPedanticParserDefaultValue;
|
||||||
ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
|
ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
|
||||||
|
@ -110,6 +110,7 @@ LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
|
|||||||
LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
|
LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
|
||||||
LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
|
||||||
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
|
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
|
||||||
|
LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
|
||||||
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 xmlStringText[];
|
||||||
|
8
tree.c
8
tree.c
@ -2557,7 +2557,13 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
|
|||||||
|
|
||||||
ret->doc = doc;
|
ret->doc = doc;
|
||||||
ret->parent = parent;
|
ret->parent = parent;
|
||||||
if (node->name != NULL)
|
if (node->name == xmlStringText)
|
||||||
|
ret->name = xmlStringText;
|
||||||
|
else if (node->name == xmlStringTextNoenc)
|
||||||
|
ret->name = xmlStringTextNoenc;
|
||||||
|
else if (node->name == xmlStringComment)
|
||||||
|
ret->name = xmlStringComment;
|
||||||
|
else if (node->name != NULL)
|
||||||
ret->name = xmlStrdup(node->name);
|
ret->name = xmlStrdup(node->name);
|
||||||
if ((node->content != NULL) && (node->type != XML_ENTITY_REF_NODE)) {
|
if ((node->content != NULL) && (node->type != XML_ENTITY_REF_NODE)) {
|
||||||
#ifndef XML_USE_BUFFER_CONTENT
|
#ifndef XML_USE_BUFFER_CONTENT
|
||||||
|
5
xpath.c
5
xpath.c
@ -4190,6 +4190,7 @@ xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
if (cur == NULL) XP_ERROR(XPATH_INVALID_OPERAND);
|
if (cur == NULL) XP_ERROR(XPATH_INVALID_OPERAND);
|
||||||
switch (cur->type) {
|
switch (cur->type) {
|
||||||
case XPATH_NODESET:
|
case XPATH_NODESET:
|
||||||
|
case XPATH_XSLT_TREE:
|
||||||
if ((cur->nodesetval == NULL) ||
|
if ((cur->nodesetval == NULL) ||
|
||||||
(cur->nodesetval->nodeNr == 0)) res = 0;
|
(cur->nodesetval->nodeNr == 0)) res = 0;
|
||||||
else
|
else
|
||||||
@ -5419,7 +5420,9 @@ xmlXPathEvalAndExpr(xmlXPathParserContextPtr ctxt) {
|
|||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
xmlXPathEvalEqualityExpr(ctxt);
|
xmlXPathEvalEqualityExpr(ctxt);
|
||||||
CHECK_ERROR;
|
CHECK_ERROR;
|
||||||
|
xmlXPathBooleanFunction(ctxt, 1);
|
||||||
arg2 = valuePop(ctxt);
|
arg2 = valuePop(ctxt);
|
||||||
|
xmlXPathBooleanFunction(ctxt, 1);
|
||||||
arg1 = valuePop(ctxt);
|
arg1 = valuePop(ctxt);
|
||||||
arg1->boolval &= arg2->boolval;
|
arg1->boolval &= arg2->boolval;
|
||||||
valuePush(ctxt, arg1);
|
valuePush(ctxt, arg1);
|
||||||
@ -5451,7 +5454,9 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) {
|
|||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
xmlXPathEvalAndExpr(ctxt);
|
xmlXPathEvalAndExpr(ctxt);
|
||||||
CHECK_ERROR;
|
CHECK_ERROR;
|
||||||
|
xmlXPathBooleanFunction(ctxt, 1);
|
||||||
arg2 = valuePop(ctxt);
|
arg2 = valuePop(ctxt);
|
||||||
|
xmlXPathBooleanFunction(ctxt, 1);
|
||||||
arg1 = valuePop(ctxt);
|
arg1 = valuePop(ctxt);
|
||||||
arg1->boolval |= arg2->boolval;
|
arg1->boolval |= arg2->boolval;
|
||||||
valuePush(ctxt, arg1);
|
valuePush(ctxt, arg1);
|
||||||
|
Reference in New Issue
Block a user