aboutsummaryrefslogtreecommitdiffstats
path: root/xmlsave.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2004-11-05 10:03:46 +0000
committerDaniel Veillard <veillard@src.gnome.org>2004-11-05 10:03:46 +0000
commitce244ad595eafff8e78a8f55fbd0004a0b42d789 (patch)
treefb8626175a731b2846147421ff84760dd777a73d /xmlsave.c
parent38936066661217110b2d4a2704798de1baeca25e (diff)
downloadandroid_external_libxml2-ce244ad595eafff8e78a8f55fbd0004a0b42d789.tar.gz
android_external_libxml2-ce244ad595eafff8e78a8f55fbd0004a0b42d789.tar.bz2
android_external_libxml2-ce244ad595eafff8e78a8f55fbd0004a0b42d789.zip
fixed the way the generator works, extended the testing, especially with
* gentest.py testapi.c: fixed the way the generator works, extended the testing, especially with more real trees and nodes. * HTMLtree.c tree.c valid.c xinclude.c xmlIO.c xmlsave.c: a bunch of real problems found and fixed. * entities.c: fix error reporting to go through the new handlers Daniel
Diffstat (limited to 'xmlsave.c')
-rw-r--r--xmlsave.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/xmlsave.c b/xmlsave.c
index 0598f3f9..fd02735f 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -445,6 +445,7 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
static void xmlNodeListDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
+static void xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur);
/**
* xmlNsDumpOutput:
@@ -456,7 +457,7 @@ void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
*/
static void
xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) {
- if (cur == NULL) return;
+ if ((cur == NULL) || (buf == NULL)) return;
if ((cur->type == XML_LOCAL_NAMESPACE) && (cur->href != NULL)) {
if (xmlStrEqual(cur->prefix, BAD_CAST "xml"))
return;
@@ -557,6 +558,7 @@ xmlAttrDumpOutput(xmlSaveCtxtPtr ctxt, xmlAttrPtr cur) {
if (cur == NULL) return;
buf = ctxt->buf;
+ if (buf == NULL) return;
xmlOutputBufferWrite(buf, 1, " ");
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
@@ -634,6 +636,11 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
return;
if (cur->type == XML_XINCLUDE_END)
return;
+ if ((cur->type == XML_DOCUMENT_NODE) ||
+ (cur->type == XML_HTML_DOCUMENT_NODE)) {
+ xmlDocContentDumpOutput(ctxt, (xmlDocPtr) cur);
+ return;
+ }
if (cur->type == XML_DTD_NODE) {
xmlDtdDumpOutput(ctxt, (xmlDtdPtr) cur);
return;
@@ -1790,6 +1797,8 @@ xmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
xmlInitParser();
+ if ((buf == NULL) || (cur == NULL)) return;
+
memset(&ctxt, 0, sizeof(ctxt));
ctxt.doc = doc;
ctxt.buf = buf;
@@ -2083,7 +2092,9 @@ xmlSaveFormatFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur,
int ret;
if (buf == NULL) return(-1);
- if (cur == NULL) {
+ if ((cur == NULL) ||
+ ((cur->type != XML_DOCUMENT_NODE) &&
+ (cur->type != XML_HTML_DOCUMENT_NODE))) {
xmlOutputBufferClose(buf);
return(-1);
}