Преглед на файлове

2006-02-14 Atsushi Enomoto <[email protected]>

	* XmlTextWriter.cs : WriteRaw("") is not simply ignored but process
	  state check and closes open tag.

	* XmlTextWriterTests.cs : added test WriteRaw("") closes open tag.


svn path=/trunk/mcs/; revision=56842
Atsushi Eno преди 20 години
родител
ревизия
f99e279c01

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

@@ -1,3 +1,8 @@
+2006-02-14  Atsushi Enomoto <[email protected]>
+
+	* XmlTextWriter.cs : WriteRaw("") is not simply ignored but process
+	  state check and closes open tag.
+
 2006-02-11  Atsushi Enomoto <[email protected]>
 
 	* XmlTextReader.cs :

+ 1 - 1
mcs/class/System.XML/System.Xml/XmlTextWriter.cs

@@ -1111,7 +1111,7 @@ namespace System.Xml
 
 		private void WriteStringInternal (string text, bool entitize)
 		{
-			if (text == null || text.Length == 0)
+			if (text == null || text.Length == 0 && entitize)
 				return;
 			
 			CheckState ();

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

@@ -1,3 +1,7 @@
+2006-02-14  Atsushi Enomoto  <[email protected]>
+
+	* XmlTextWriterTests.cs : added test WriteRaw("") closes open tag.
+
 2006-02-14  Atsushi Enomoto  <[email protected]>
 
 	* XmlTextWriterTests.cs : numbered some tests and added some comments.

+ 14 - 0
mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs

@@ -2143,6 +2143,20 @@ namespace MonoTests.System.Xml
 			xtw.WriteStartDocument ();
 		}
 
+		[Test]
+		public void WriteStringEmptyCloseStartTag ()
+		{
+			xtw.WriteStartElement ("stream", "stream","http://etherx.jabber.org/streams");
+			xtw.WriteAttributeString ("version", "1.0");
+			xtw.WriteAttributeString ("to", "[email protected]");
+			xtw.WriteAttributeString ("from", "server");
+			xtw.WriteAttributeString ("xmlns", "jabber:client");
+			xtw.WriteRaw ("");// Ensure that the tag is closed
+			xtw.Flush ();
+
+			Assert.AreEqual ("<stream:stream version='1.0' to='[email protected]' from='server' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>", StringWriterText);
+		}
+
 #if NET_2_0
 		[Test]
 		[ExpectedException (typeof (InvalidOperationException))]