2004-05-27 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 27 May 2004 08:22:09 +0000 (08:22 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 27 May 2004 08:22:09 +0000 (08:22 -0000)
* XmlDocument.cs : Save() should indent only when PreserveWhitespace
  is false. Fixed bug #59155.
  Modified comment lines a bit.

svn path=/trunk/mcs/; revision=28234

mcs/class/System.XML/System.Xml/ChangeLog
mcs/class/System.XML/System.Xml/XmlDocument.cs

index 77a6d482eb5b05b84067d14fbf51f1e3b8d91e84..35bf9e5b2787a5af7dce7cf0415092d32cc32008 100644 (file)
@@ -1,3 +1,9 @@
+2004-05-27  Atsushi Enomoto <atsushi@ximian.com>
+
+       * XmlDocument.cs : Save() should indent only when PreserveWhitespace
+         is false. Fixed bug #59155.
+         Modified comment lines a bit.
+
 2004-05-27  Atsushi Enomoto <atsushi@ximian.com>
 
        * XmlTextWriter.cs : WriteRaw() looks to proceed WriteState to Prolog
index f186a9ab22118f6f895aa10f66020c6767356d8f..1b728de77c8bbefaa5fb18de14fed36b445e7239 100644 (file)
@@ -321,7 +321,7 @@ namespace System.Xml
                {
                        if ((localName == null) || (localName == String.Empty))
                                throw new ArgumentException ("The local name for elements or attributes cannot be null or an empty string.");
-                       // FIXME: MS.NET has a weird behavior that they can Load() from XmlTextReader 
+                       // LAMESPEC: MS.NET has a weird behavior that they can Load() from XmlTextReader 
                        // whose Namespaces = false, but their CreateElement() never allows qualified name.
                        // I leave it as it is.
                        return new XmlElement (prefix != null ? prefix : String.Empty, localName, namespaceURI != null ? namespaceURI : String.Empty, this, false);
@@ -429,7 +429,7 @@ namespace System.Xml
                // check on GetIdenticalAttribute. To make such way complete,
                // we have to use MultiMap, not Hashtable.
                //
-               // Well, MS.NET is also fragile around ID.
+               // Well, MS.NET is also fragile around here.
                public virtual XmlElement GetElementById (string elementId)
                {
                        XmlAttribute attr = GetIdenticalAttribute (elementId);
@@ -850,7 +850,8 @@ namespace System.Xml
                public virtual void Save (Stream outStream)
                {
                        XmlTextWriter xmlWriter = new XmlTextWriter (outStream, TextEncoding);
-                       xmlWriter.Formatting = Formatting.Indented;
+                       if (!PreserveWhitespace)
+                               xmlWriter.Formatting = Formatting.Indented;
                        WriteContentTo (xmlWriter);
                        xmlWriter.Flush ();
                }
@@ -859,7 +860,8 @@ namespace System.Xml
                {
                        XmlTextWriter xmlWriter = new XmlTextWriter (filename, TextEncoding);
                        try {
-                               xmlWriter.Formatting = Formatting.Indented;
+                               if (!PreserveWhitespace)
+                                       xmlWriter.Formatting = Formatting.Indented;
                                WriteContentTo (xmlWriter);
                        } finally {
                                xmlWriter.Close ();
@@ -869,7 +871,8 @@ namespace System.Xml
                public virtual void Save (TextWriter writer)
                {
                        XmlTextWriter xmlWriter = new XmlTextWriter (writer);
-                       xmlWriter.Formatting = Formatting.Indented;
+                       if (!PreserveWhitespace)
+                               xmlWriter.Formatting = Formatting.Indented;
                        if (FirstChild != null && FirstChild.NodeType != XmlNodeType.XmlDeclaration)
                                xmlWriter.WriteStartDocument ();
                        WriteContentTo (xmlWriter);