Prechádzať zdrojové kódy

2005-12-26 Atsushi Enomoto <[email protected]>

        * XmlTextWriter.cs : when namespaceURI is String.Empty, Prefix
          should be just ignored (it is likely to happen that DOM nodes
          with empty namespace URI are specified non-empty prefix by
          users, which had better be just ignored). Fixed bug #77095.

        * XmlTextWriterTests.cs : enabled
          WriteStartElement_Prefix_EmptyNamespace() and
          NamespacesPrefixWithEmptyAndNullNamespaceEmpty().


svn path=/trunk/mcs/; revision=54850
Atsushi Eno 20 rokov pred
rodič
commit
1bdcf7c5fa

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

@@ -1,3 +1,10 @@
+2005-12-26  Atsushi Enomoto <[email protected]>
+
+	* XmlTextWriter.cs : when namespaceURI is String.Empty, Prefix
+	  should be just ignored (it is likely to happen that DOM nodes
+	  with empty namespace URI are specified non-empty prefix by
+	  users, which had better be just ignored). Fixed bug #77095.
+
 2005-12-26  Atsushi Enomoto <[email protected]>
 
 	* XmlElement.cs : patch for Prefix property by Vorobiev Maksim.

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

@@ -910,7 +910,7 @@ openElements [openElementCount - 1]).IndentingOverriden;
 			if (!Namespaces && (((prefix != null) && (prefix != String.Empty))
 				|| ((ns != null) && (ns != String.Empty))))
 				throw ArgumentError ("Cannot set the namespace if Namespaces is 'false'.");
-			if ((prefix != null && prefix != String.Empty) && ((ns == null) || (ns == String.Empty)))
+			if ((prefix != null && prefix.Length > 0) && ((ns == null)))
 				throw ArgumentError ("Cannot use a prefix with an empty namespace.");
 
 			// ignore non-namespaced node's prefix.

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

@@ -1,3 +1,9 @@
+2005-12-26  Atsushi Enomoto <[email protected]>
+
+	* XmlTextWriterTests.cs : enabled
+	  WriteStartElement_Prefix_EmptyNamespace() and
+	  NamespacesPrefixWithEmptyAndNullNamespaceEmpty().
+
 2005-12-26  Atsushi Enomoto <[email protected]>
 
 	* XmlElementTests.cs : Patch by Vorobiev Maksim.

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

@@ -503,22 +503,15 @@ namespace MonoTests.System.Xml
 			Assert.AreEqual ("< xmlns='http://somenamespace.com' />", StringWriterText, "#8");
 		}
 
-#if NET_2_0
-		[Category ("NotWorking")] // bug #77095: in 2.0 profile, an empty namespace should be allowed
-#else
-		[ExpectedException (typeof (ArgumentException))]
-#endif
 		[Test]
 		public void WriteStartElement_Prefix_EmptyNamespace ()
 		{
 			xtw.WriteStartElement ("x", "whatever", "");
-#if NET_2_0
 			Assert.AreEqual ("<whatever", StringWriterText, "#1");
 
 			xtw.WriteEndElement ();
 
 			Assert.AreEqual ("<whatever />", StringWriterText, "#2");
-#endif
 		}
 
 		[Test]
@@ -1014,10 +1007,6 @@ namespace MonoTests.System.Xml
 		}
 
 		[Test]
-		[ExpectedException (typeof (ArgumentException))]
-#if NET_2_0
-		[Category ("NotDotNet")] // ... bug or design?
-#endif
 		public void NamespacesPrefixWithEmptyAndNullNamespaceEmpty ()
 		{
 			xtw.WriteStartElement ("foo", "bar", "");