diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2005-12-26 17:57:23 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2005-12-26 17:57:23 +0300 |
commit | 1bdcf7c5fa4a82cd2106aa0fccc9f73be1fbb005 (patch) | |
tree | 9d2ef0b1c0afa8b9153f63be159461b837dbb057 /mcs/class/System.XML | |
parent | d120a4fc6e3ca5c8b202173e1a34d77d3d12b3de (diff) |
2005-12-26 Atsushi Enomoto <atsushi@ximian.com>
* 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
Diffstat (limited to 'mcs/class/System.XML')
4 files changed, 14 insertions, 12 deletions
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,5 +1,12 @@ 2005-12-26 Atsushi Enomoto <atsushi@ximian.com> + * 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 <atsushi@ximian.com> + * XmlElement.cs : patch for Prefix property by Vorobiev Maksim. - null should cause ArgumentNullException. - "" should not raise an error. 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,5 +1,11 @@ 2005-12-26 Atsushi Enomoto <atsushi@ximian.com> + * XmlTextWriterTests.cs : enabled + WriteStartElement_Prefix_EmptyNamespace() and + NamespacesPrefixWithEmptyAndNullNamespaceEmpty(). + +2005-12-26 Atsushi Enomoto <atsushi@ximian.com> + * XmlElementTests.cs : Patch by Vorobiev Maksim. - setting null to Prefix should raise ArgumentNullException. - setting String.Empty to Prefix should be allowed. 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 ("<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", ""); |