From 7533cc8fda1f29a6b7f77202d249c8ff18cbda4f Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 24 Apr 2001 15:52:00 +0000 Subject: [PATCH] Good old cycle: new release, new bug reports, new fixes ... - HTMLtree.c HTMLtree.h : closing #53402 i.e. output of PIs when using xsl:output - valid.c: closing #53537 some case generate segfaults if there is validity errors Daniel --- ChangeLog | 7 +++++++ HTMLtree.c | 25 +++++++++++++++++++++++++ HTMLtree.h | 1 + error.c | 2 +- include/libxml/HTMLtree.h | 1 + valid.c | 10 +++++----- 6 files changed, 40 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e9ae52c..8c8e348c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Apr 24 17:36:35 CEST 2001 Daniel Veillard + + * HTMLtree.c HTMLtree.h : closing #53402 i.e. output of + PIs when using xsl:output + * valid.c: closing #53537 some case generate segfaults if there + is validity errors + Tue Apr 24 15:19:53 CEST 2001 Daniel Veillard * SAX.c testDocbook.c DOCBparser.c: more work on the support diff --git a/HTMLtree.c b/HTMLtree.c index 5c18a9d4..51a72f91 100644 --- a/HTMLtree.c +++ b/HTMLtree.c @@ -515,6 +515,18 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) { } return; } + if (cur->type == HTML_PI_NODE) { + if (cur->content != NULL) { + xmlBufferWriteChar(buf, "content); +#else + xmlBufferWriteCHAR(buf, xmlBufferContent(cur->content)); +#endif + xmlBufferWriteChar(buf, ">"); + } + return; + } if (cur->type == HTML_ENTITY_REF_NODE) { xmlBufferWriteChar(buf, "&"); xmlBufferWriteCHAR(buf, cur->name); @@ -867,6 +879,19 @@ htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, } return; } + if (cur->type == HTML_PI_NODE) { + if (cur->content != NULL) { + xmlOutputBufferWriteString(buf, "content); +#else + xmlOutputBufferWriteString(buf, (const char *) + xmlBufferContent(cur->content)); +#endif + xmlOutputBufferWriteString(buf, ">"); + } + return; + } if (cur->type == HTML_ENTITY_REF_NODE) { xmlOutputBufferWriteString(buf, "&"); xmlOutputBufferWriteString(buf, (const char *)cur->name); diff --git a/HTMLtree.h b/HTMLtree.h index 543d693d..3888f7cc 100644 --- a/HTMLtree.h +++ b/HTMLtree.h @@ -23,6 +23,7 @@ extern "C" { #define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE #define HTML_COMMENT_NODE XML_COMMENT_NODE #define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE +#define HTML_PI_NODE XML_PI_NODE htmlDocPtr htmlNewDoc (const xmlChar *URI, const xmlChar *ExternalID); diff --git a/error.c b/error.c index 81d722d1..0bb3a844 100644 --- a/error.c +++ b/error.c @@ -132,7 +132,7 @@ xmlParserPrintFileContext(xmlParserInputPtr input) { cur--; } n = 0; - ctnt = content; + ctnt = content; while ((n++ < 79) && (cur > base) && (*cur != '\n') && (*cur != '\r')) { *ctnt++ = ' '; cur--; diff --git a/include/libxml/HTMLtree.h b/include/libxml/HTMLtree.h index 543d693d..3888f7cc 100644 --- a/include/libxml/HTMLtree.h +++ b/include/libxml/HTMLtree.h @@ -23,6 +23,7 @@ extern "C" { #define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE #define HTML_COMMENT_NODE XML_COMMENT_NODE #define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE +#define HTML_PI_NODE XML_PI_NODE htmlDocPtr htmlNewDoc (const xmlChar *URI, const xmlChar *ExternalID); diff --git a/valid.c b/valid.c index fe13778f..f6590cc4 100644 --- a/valid.c +++ b/valid.c @@ -3286,7 +3286,7 @@ xmlValidateElementType(xmlValidCtxtPtr ctxt) { return(1); } if (CONT == NULL) return(-1); - if (NODE->type == XML_ENTITY_REF_NODE) + if ((NODE != NULL) && (NODE->type == XML_ENTITY_REF_NODE)) return(-2); /* @@ -3643,7 +3643,7 @@ xmlSprintfElements(char *buf, xmlNodePtr node, int glob) { static int xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child, - xmlElementContentPtr cont, int warn) { + xmlElementContentPtr cont, int warn, const xmlChar *name) { int ret; xmlNodePtr repl = NULL, last = NULL, cur, tmp; @@ -3757,10 +3757,10 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child, else xmlSprintfElements(list, child, 1); - if ((child->parent != NULL) && (child->parent->name != NULL)) { + if (name != NULL) { VERROR(ctxt->userData, "Element %s content doesn't follow the Dtd\nExpecting %s, got %s\n", - child->parent->name, expr, list); + name, expr, list); } else { VERROR(ctxt->userData, "Element content doesn't follow the Dtd\nExpecting %s, got %s\n", @@ -3996,7 +3996,7 @@ child_ok: case XML_ELEMENT_TYPE_ELEMENT: child = elem->children; cont = elemDecl->content; - ret = xmlValidateElementContent(ctxt, child, cont, 1); + ret = xmlValidateElementContent(ctxt, child, cont, 1, elem->name); break; }