applied patch from Alfred Mickautsch to flush the output at the end of

* xmlwriter.c: applied patch from Alfred Mickautsch to flush the
  output at the end of document.
Daniel

svn path=/trunk/; revision=3691
diff --git a/xmlwriter.c b/xmlwriter.c
index 2d9d109..c6959b8 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -626,9 +626,10 @@
  * xmlTextWriterEndDocument:
  * @writer:  the xmlTextWriterPtr
  *
- * End an xml document. All open elements are closed
+ * End an xml document. All open elements are closed, and
+ * the content is flushed to the output.
  *
- * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
+ * Returns the bytes written or -1 in case of error
  */
 int
 xmlTextWriterEndDocument(xmlTextWriterPtr writer)
@@ -702,6 +703,9 @@
             return -1;
         sum += count;
     }
+
+    sum += xmlTextWriterFlush(writer);
+
     return sum;
 }