diff options
author | Konstantin Triger <kostat@mono-cvs.ximian.com> | 2005-12-15 13:18:32 +0300 |
---|---|---|
committer | Konstantin Triger <kostat@mono-cvs.ximian.com> | 2005-12-15 13:18:32 +0300 |
commit | 231afa731c873388fd7b4902562562c81d8a3be2 (patch) | |
tree | 8dcb304d461285ac24be851323afafc80382fc39 /mcs/class/System.XML | |
parent | 1f787e426abc0799516a4d4585b8f7d4670de651 (diff) |
allow null string in WriteCData
svn path=/trunk/mcs/; revision=54441
Diffstat (limited to 'mcs/class/System.XML')
4 files changed, 18 insertions, 0 deletions
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog index 44082682cae..94522d42ece 100644 --- a/mcs/class/System.XML/System.Xml/ChangeLog +++ b/mcs/class/System.XML/System.Xml/ChangeLog @@ -1,3 +1,7 @@ +2005-12-15 Konstantin Triger <kostat@mainsoft.com> + + * XmlTextWriter.cs: allow null string in WriteCData. + 2005-12-14 Atsushi Enomoto <atsushi@ximian.com> * XmlNode.cs : (GetNamespaceOfPrefix) return const xml/xmlns URIs diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs index 0ca586d605d..bd6996ee543 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs @@ -457,6 +457,9 @@ openElements [openElementCount - 1]).IndentingOverriden; public override void WriteCData (string text) { + if (text == null) + text = String.Empty; + if (text.IndexOf ("]]>") >= 0) throw ArgumentError ("CDATA section cannot contain text \"]]>\"."); diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog index 55a54f803fa..bf8a08e36ad 100644 --- a/mcs/class/System.XML/Test/System.Xml/ChangeLog +++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog @@ -1,3 +1,7 @@ +2005-12-15 Konstantin Triger <kostat@mainsoft.com> + + * XmlTextWriterTests.cs: added WriteCDataNull test. + 2005-12-14 Atsushi Enomoto <atsushi@ximian.com> * XmlDocumentTests.cs : (CreateNodeNodeTypeName) the previous fix was diff --git a/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs index 8a2d377f44a..b52cac41251 100644 --- a/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs +++ b/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs @@ -170,6 +170,13 @@ namespace MonoTests.System.Xml } [Test] + public void CDataNull () + { + xtw.WriteCData (null); + AssertEquals ("WriteCData had incorrect output.", "<![CDATA[]]>", StringWriterText); + } + + [Test] [ExpectedException (typeof (ArgumentException))] public void CDataInvalid () { |