浏览代码

2002-05-26 Miguel de Icaza <[email protected]>

	* XmlDocument.cs: Implement the Save methods.

svn path=/trunk/mcs/; revision=4935
Miguel de Icaza 23 年之前
父节点
当前提交
aaa4e5c7c4
共有 2 个文件被更改,包括 29 次插入9 次删除
  1. 4 0
      mcs/class/System.XML/System.Xml/ChangeLog
  2. 25 9
      mcs/class/System.XML/System.Xml/XmlDocument.cs

+ 4 - 0
mcs/class/System.XML/System.Xml/ChangeLog

@@ -1,3 +1,7 @@
+2002-05-26  Miguel de Icaza  <[email protected]>
+
+	* XmlDocument.cs: Implement the Save methods.
+
 2002-05-08  Mike Kestner  <[email protected]>
 
 	* XmlNamedNodeMap.cs (SetNamedItem): Fixed a copy/paste bug.

+ 25 - 9
mcs/class/System.XML/System.Xml/XmlDocument.cs

@@ -1,13 +1,19 @@
 //
 // System.Xml.XmlDocument
 //
-// Author:
+// Authors:
 //   Daniel Weber ([email protected])
+//   Kral Ferch <[email protected]>
+//   Jason Diamond <[email protected]>
+//   Miguel de Icaza ([email protected])
 //
 // (C) 2001 Daniel Weber
+// (C) 2002 Kral Ferch, Jason Diamond, Miguel de Icaza
+//
 
 using System;
 using System.IO;
+using System.Text;
 using System.Xml.XPath;
 using System.Diagnostics;
 
@@ -523,28 +529,38 @@ namespace System.Xml
 			throw new NotImplementedException ();
 		}
 
-		[MonoTODO]
+		[MonoTODO ("Verify what encoding is used by default;  Should use PreserveWhiteSpace")]
 		public virtual void Save(Stream outStream)
 		{
-			throw new NotImplementedException ();
+			XmlTextWriter xmlWriter = new XmlTextWriter (outStream, Encoding.UTF8);
+			WriteContentTo (xmlWriter);
+			xmlWriter.Close ();
 		}
 
-		[MonoTODO]
+		[MonoTODO ("Verify what encoding is used by default; Should use PreseveWhiteSpace")]
 		public virtual void Save (string filename)
 		{
-			throw new NotImplementedException ();
+			XmlTextWriter xmlWriter = new XmlTextWriter (filename, Encoding.UTF8);
+			WriteContentTo (xmlWriter);
+			xmlWriter.Close ();
 		}
 
 		[MonoTODO]
 		public virtual void Save (TextWriter writer)
 		{
-			throw new NotImplementedException ();
+			XmlTextWriter xmlWriter = new XmlTextWriter (writer);
+			WriteContentTo (xmlWriter);
+			xmlWriter.Flush ();
 		}
 
-		[MonoTODO]
-		public virtual void Save (XmlWriter writer)
+		[MonoTODO ("Should preserve white space if PreserveWhisspace is set")]
+		public virtual void Save (XmlWriter xmlWriter)
 		{
-			throw new NotImplementedException ();
+			//
+			// This should preserve white space if PreserveWhiteSpace is true
+			//
+			WriteContentTo (xmlWriter);
+			xmlWriter.Flush ();
 		}
 
 		public override void WriteContentTo (XmlWriter w)