From a02f199d7b71c8d3aadaa04d724db2081cf337ac Mon Sep 17 00:00:00 2001 From: Rob Richards Date: Sat, 16 Sep 2006 14:04:26 +0000 Subject: [PATCH] xmlTextConcat works with comments and PI nodes (bug #355962). fix * tree.c: xmlTextConcat works with comments and PI nodes (bug #355962). * parser.c: fix resulting tree corruption when using XML namespace with existing doc in xmlParseBalancedChunkMemoryRecover. --- ChangeLog | 6 ++++++ parser.c | 4 ++++ tree.c | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5bfc922a..ac4e5359 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Sep 16 16:02:23 CEST 2006 Rob Richards + + * tree.c: xmlTextConcat works with comments and PI nodes (bug #355962). + * parser.c: fix resulting tree corruption when using XML namespace + with existing doc in xmlParseBalancedChunkMemoryRecover. + Fri Sep 1 11:52:55 CEST 2006 Daniel Veillard * xmlIO.c: another patch from Emelyanov Alexey to clean up a few things diff --git a/parser.c b/parser.c index ceb91d2e..e30427cc 100644 --- a/parser.c +++ b/parser.c @@ -11903,6 +11903,9 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, } else { ctxt->myDoc = newDoc; newDoc->children->doc = doc; + /* Ensure that doc has XML spec namespace */ + xmlSearchNsByHref(doc, (xmlNodePtr)doc, XML_XML_NAMESPACE); + newDoc->oldNs = doc->oldNs; } ctxt->instate = XML_PARSER_CONTENT; ctxt->depth = depth; @@ -11963,6 +11966,7 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, xmlFreeParserCtxt(ctxt); newDoc->intSubset = NULL; newDoc->extSubset = NULL; + newDoc->oldNs = NULL; xmlFreeDoc(newDoc); return(ret); diff --git a/tree.c b/tree.c index 26e5abdf..07a555aa 100644 --- a/tree.c +++ b/tree.c @@ -6529,7 +6529,9 @@ xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) { if (node == NULL) return(-1); if ((node->type != XML_TEXT_NODE) && - (node->type != XML_CDATA_SECTION_NODE)) { + (node->type != XML_CDATA_SECTION_NODE) && + (node->type != XML_COMMENT_NODE) && + (node->type != XML_PI_NODE)) { #ifdef DEBUG_TREE xmlGenericError(xmlGenericErrorContext, "xmlTextConcat: node is not text nor CDATA\n");