From 1bdcf7c5fa4a82cd2106aa0fccc9f73be1fbb005 Mon Sep 17 00:00:00 2001 From: Atsushi Eno Date: Mon, 26 Dec 2005 14:57:23 +0000 Subject: 2005-12-26 Atsushi Enomoto * 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 --- mcs/class/System.XML/System.Xml/ChangeLog | 7 +++++++ mcs/class/System.XML/System.Xml/XmlTextWriter.cs | 2 +- mcs/class/System.XML/Test/System.Xml/ChangeLog | 6 ++++++ mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs | 11 ----------- 4 files changed, 14 insertions(+), 12 deletions(-) (limited to 'mcs/class/System.XML') diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog index 60c36089104..3cb903a3edb 100644 --- a/mcs/class/System.XML/System.Xml/ChangeLog +++ b/mcs/class/System.XML/System.Xml/ChangeLog @@ -1,3 +1,10 @@ +2005-12-26 Atsushi Enomoto + + * 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 * XmlElement.cs : patch for Prefix property by Vorobiev Maksim. diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs index 52be9d27981..5328ec467af 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs +++ b/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. diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog index bed9f0ed172..ca84f27a785 100644 --- a/mcs/class/System.XML/Test/System.Xml/ChangeLog +++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog @@ -1,3 +1,9 @@ +2005-12-26 Atsushi Enomoto + + * XmlTextWriterTests.cs : enabled + WriteStartElement_Prefix_EmptyNamespace() and + NamespacesPrefixWithEmptyAndNullNamespaceEmpty(). + 2005-12-26 Atsushi Enomoto * XmlElementTests.cs : Patch by Vorobiev Maksim. diff --git a/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs index 7077131460d..9d952de9693 100644 --- a/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs +++ b/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 ("", 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", ""); -- cgit v1.2.3