fixed #145092 by adding an xmlSaveOption to omit XML declaration Daniel

* xmlsave.c include/libxml/xmlsave.h: fixed #145092 by adding
  an xmlSaveOption to omit XML declaration
Daniel
diff --git a/ChangeLog b/ChangeLog
index d2944b5..281892c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Aug  8 16:43:04 CEST 2005 Daniel Veillard <daniel@veillard.com>
+
+	* xmlsave.c include/libxml/xmlsave.h: fixed #145092 by adding 
+	  an xmlSaveOption to omit XML declaration
+
 Mon Aug  8 15:44:54 CEST 2005 Daniel Veillard <daniel@veillard.com>
 
 	* HTMLtree.c: fixed bug #310333 with a patch close to the provided
diff --git a/include/libxml/xmlsave.h b/include/libxml/xmlsave.h
index 534fefd..7b8f42c 100644
--- a/include/libxml/xmlsave.h
+++ b/include/libxml/xmlsave.h
@@ -27,7 +27,8 @@
  * to the xmlSaveToFd() and similar calls.
  */
 typedef enum {
-    XML_SAVE_FORMAT     = 1<<0	/* format save output */
+    XML_SAVE_FORMAT     = 1<<0,	/* format save output */
+    XML_SAVE_NO_DECL    = 1<<1	/* drop the xml declaration */
 } xmlSaveOption;
 
 
diff --git a/xmlsave.c b/xmlsave.c
index d6e3e65..29619c7 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -826,31 +826,33 @@
         cur->encoding = BAD_CAST ctxt->encoding;
 
     buf = ctxt->buf;
-    xmlOutputBufferWrite(buf, 14, "<?xml version=");
-    if (cur->version != NULL) 
-	xmlBufferWriteQuotedString(buf->buffer, cur->version);
-    else
-	xmlOutputBufferWrite(buf, 5, "\"1.0\"");
-    if (ctxt->encoding == NULL) {
-	if (cur->encoding != NULL)
-	    encoding = cur->encoding;
-	else if (cur->charset != XML_CHAR_ENCODING_UTF8)
-	    encoding = (const xmlChar *)
-	         xmlGetCharEncodingName((xmlCharEncoding) cur->charset);
+    if ((ctxt->options & XML_SAVE_NO_DECL) == 0) {
+	xmlOutputBufferWrite(buf, 14, "<?xml version=");
+	if (cur->version != NULL) 
+	    xmlBufferWriteQuotedString(buf->buffer, cur->version);
+	else
+	    xmlOutputBufferWrite(buf, 5, "\"1.0\"");
+	if (ctxt->encoding == NULL) {
+	    if (cur->encoding != NULL)
+		encoding = cur->encoding;
+	    else if (cur->charset != XML_CHAR_ENCODING_UTF8)
+		encoding = (const xmlChar *)
+		     xmlGetCharEncodingName((xmlCharEncoding) cur->charset);
+	}
+	if (encoding != NULL) {
+	    xmlOutputBufferWrite(buf, 10, " encoding=");
+	    xmlBufferWriteQuotedString(buf->buffer, (xmlChar *) encoding);
+	}
+	switch (cur->standalone) {
+	    case 0:
+		xmlOutputBufferWrite(buf, 16, " standalone=\"no\"");
+		break;
+	    case 1:
+		xmlOutputBufferWrite(buf, 17, " standalone=\"yes\"");
+		break;
+	}
+	xmlOutputBufferWrite(buf, 3, "?>\n");
     }
-    if (encoding != NULL) {
-        xmlOutputBufferWrite(buf, 10, " encoding=");
-	xmlBufferWriteQuotedString(buf->buffer, (xmlChar *) encoding);
-    }
-    switch (cur->standalone) {
-        case 0:
-	    xmlOutputBufferWrite(buf, 16, " standalone=\"no\"");
-	    break;
-        case 1:
-	    xmlOutputBufferWrite(buf, 17, " standalone=\"yes\"");
-	    break;
-    }
-    xmlOutputBufferWrite(buf, 3, "?>\n");
 
 #ifdef LIBXML_HTML_ENABLED
     dtd = xmlGetIntSubset(cur);