fix bug #322136 in xmlNodeBufGetContent when entity ref is a child of an

* tree.c: fix bug #322136 in xmlNodeBufGetContent when entity ref is
  a child of an element (fix by Oleksandr Kononenko).
* HTMLtree.c include/libxml/HTMLtree.h: Add htmlDocDumpMemoryFormat.
This commit is contained in:
Rob Richards 2005-12-20 15:55:14 +00:00
parent 5bb0c08d2f
commit 77b92ff6a8
4 changed files with 32 additions and 5 deletions

View File

@ -1,3 +1,9 @@
Tue Dec 20 16:55:31 CET 2005 Rob Richards <rrichards@ctindustries.net>
* tree.c: fix bug #322136 in xmlNodeBufGetContent when entity ref is
a child of an element (fix by Oleksandr Kononenko).
* HTMLtree.c include/libxml/HTMLtree.h: Add htmlDocDumpMemoryFormat.
Tue Dec 20 11:43:06 CET 2005 Kasimier Buchcik <libxml2-cvs@cazic.ne>
* xmlschemas.c xmlstring.c: Fixed a segfault during

View File

@ -506,16 +506,17 @@ htmlNodeDumpFile(FILE *out, xmlDocPtr doc, xmlNodePtr cur) {
}
/**
* htmlDocDumpMemory:
* htmlDocDumpMemoryFormat:
* @cur: the document
* @mem: OUT: the memory pointer
* @size: OUT: the memory length
* @format: should formatting spaces been added
*
* Dump an HTML document in memory and return the xmlChar * and it's size.
* It's up to the caller to free the memory.
*/
void
htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
htmlDocDumpMemoryFormat(xmlDocPtr cur, xmlChar**mem, int *size, int format) {
xmlOutputBufferPtr buf;
xmlCharEncodingHandlerPtr handler = NULL;
const char *encoding;
@ -572,7 +573,8 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
return;
}
htmlDocContentDumpOutput(buf, cur, NULL);
htmlDocContentDumpFormatOutput(buf, cur, NULL, format);
xmlOutputBufferFlush(buf);
if (buf->conv != NULL) {
*size = buf->conv->use;
@ -584,6 +586,20 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
(void)xmlOutputBufferClose(buf);
}
/**
* htmlDocDumpMemory:
* @cur: the document
* @mem: OUT: the memory pointer
* @size: OUT: the memory length
*
* Dump an HTML document in memory and return the xmlChar * and it's size.
* It's up to the caller to free the memory.
*/
void
htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
htmlDocDumpMemoryFormat(cur, mem, size, 1);
}
/************************************************************************
* *

View File

@ -75,6 +75,11 @@ XMLPUBFUN void XMLCALL
htmlDocDumpMemory (xmlDocPtr cur,
xmlChar **mem,
int *size);
XMLPUBFUN void XMLCALL
htmlDocDumpMemoryFormat (xmlDocPtr cur,
xmlChar **mem,
int *size,
int format);
XMLPUBFUN int XMLCALL
htmlDocDump (FILE *f,
xmlDocPtr cur);

4
tree.c
View File

@ -4906,8 +4906,8 @@ xmlNodeBufGetContent(xmlBufferPtr buffer, xmlNodePtr cur)
xmlBufferCat(buffer, tmp->content);
break;
case XML_ENTITY_REF_NODE:
xmlNodeBufGetContent(buffer, tmp->children);
break;
xmlNodeBufGetContent(buffer, tmp);
break;
default:
break;
}