oops forgot to modify/commit the new code. Daniel

* python/libxml.py: oops forgot to modify/commit the new code.
Daniel
diff --git a/ChangeLog b/ChangeLog
index 210e5d6..d8f88a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Dec  4 15:10:57 CET 2003 Daniel Veillard <daniel@veillard.com>
+
+	* python/libxml.py: oops forgot to modify/commit the new code.
+
 Thu Dec  4 13:29:19 CET 2003 Daniel Veillard <daniel@veillard.com>
 
 	* python/generator.py python/libxml.c python/libxml_wrap.h:
diff --git a/python/libxml.py b/python/libxml.py
index 16c2488..41103c6 100644
--- a/python/libxml.py
+++ b/python/libxml.py
@@ -1,4 +1,5 @@
 import libxml2mod
+import types
 
 #
 # Errors raised by the wrappers when some tree handling failed.
@@ -79,18 +80,37 @@
 
 class ioWriteWrapper(ioWrapper):
     def __init__(self, _obj, enc = ""):
-        ioWrapper.__init__(self, _obj)
-        self._o = libxml2mod.xmlCreateOutputBuffer(self, enc)
+#        print "ioWriteWrapper.__init__", _obj
+        if type(_obj) == type(''):
+	    print "write io from a string"
+	    self.o = None
+	elif type(_obj) == types.InstanceType:
+	    print "write io from instance of %s" % (_obj.__class__)
+	    ioWrapper.__init__(self, _obj)
+	    self._o = libxml2mod.xmlCreateOutputBuffer(self, enc)
+	else:
+	    file = libxml2mod.outputBufferGetPythonFile(_obj)
+	    if file != None:
+		ioWrapper.__init__(self, file)
+	    else:
+	        ioWrapper.__init__(self, _obj)
+	    self._o = _obj
 
     def __del__(self):
-        print "__del__"
+#        print "__del__"
         self.io_close()
         if self._o != None:
             libxml2mod.xmlOutputBufferClose(self._o)
         self._o = None
 
+    def flush(self):
+        self.io_flush()
+        if self._o != None:
+            libxml2mod.xmlOutputBufferClose(self._o)
+        self._o = None
+
     def close(self):
-        self.io_close()
+        self.io_flush()
         if self._o != None:
             libxml2mod.xmlOutputBufferClose(self._o)
         self._o = None