Jelajahi Sumber

2007-01-12 Atsushi Enomoto <[email protected]>

	* DataObject.cs : don't clear attributes or children unnecessarily.

	* DataObjectTest.cs : test to make sure to not clear attributes or
	  children unnecessarily.


svn path=/trunk/mcs/; revision=70916
Atsushi Eno 19 tahun lalu
induk
melakukan
c74b0f26b9

+ 4 - 0
mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog

@@ -1,3 +1,7 @@
+2007-01-12  Atsushi Enomoto  <[email protected]>
+
+	* DataObject.cs : don't clear attributes or children unnecessarily.
+
 2007-01-12  Atsushi Enomoto  <[email protected]>
 
 	* SignedXml.cs : actually ComputeSignature() itself does not raise

+ 2 - 2
mcs/class/System.Security/System.Security.Cryptography.Xml/DataObject.cs

@@ -88,7 +88,8 @@ namespace System.Security.Cryptography.Xml {
 				XmlDocument doc = new XmlDocument ();
 				XmlElement el = (XmlElement) doc.ImportNode (element, true);
 				doc.AppendChild (el); // FIXME: it should not be appended
-				el.RemoveAll ();
+				while (el.LastChild != null)
+					el.RemoveChild (el.LastChild);
 				foreach (XmlNode n in value)
 					el.AppendChild (doc.ImportNode (n, true));
 				element = el;
@@ -131,7 +132,6 @@ namespace System.Security.Cryptography.Xml {
 			else {
 				XmlDocument document = new XmlDocument ();
 				XmlElement el = document.ImportNode (element, true) as XmlElement;
-				el.Attributes.RemoveAll ();
 				document.AppendChild (el); // FIXME: it should not be appended
 				el.SetAttribute (attribute, value);
 				element = el;

+ 5 - 0
mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog

@@ -1,3 +1,8 @@
+2007-01-12  Atsushi Enomoto  <[email protected]>
+
+	* DataObjectTest.cs : test to make sure to not clear attributes or
+	  children unnecessarily.
+
 2007-01-12  Atsushi Enomoto  <[email protected]>
 
 	* SignedXmlTest.cs : fixed ComputeSignatureNoSigningKey() to not

+ 19 - 0
mcs/class/System.Security/Test/System.Security.Cryptography.Xml/DataObjectTest.cs

@@ -169,5 +169,24 @@ namespace MonoTests.System.Security.Cryptography.Xml {
 			AssertEquals (String.Empty, el1.OwnerDocument.OuterXml);
 			*/
 		}
+
+		[Test]
+		public void SetDataAfterId ()
+		{
+			DataObject d = new DataObject ();
+			XmlElement el = new XmlDocument ().CreateElement ("foo");
+			d.Id = "id:1";
+			d.Data = el.SelectNodes (".");
+			AssertEquals ("id:1", d.Id);
+		}
+
+		[Test]
+		public void SetMimeTypeAfterId ()
+		{
+			XmlElement el = new XmlDocument ().CreateElement ("foo");
+			DataObject d = new DataObject ("id:1", null, null, el);
+			d.MimeType = "text/html";
+			AssertEquals ("id:1", d.Id);
+		}
 	}
 }