Author: atsushi
Date: 2008-02-08 08:34:51 -0500 (Fri, 08 Feb 2008)
New Revision: 95239
Modified:
trunk/olive/class/System.Runtime.Serialization/System.Xml/ChangeLog
trunk/olive/class/System.Runtime.Serialization/System.Xml/XmlDictionaryWriter.cs
Log:
2008-02-08 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlDictionaryWriter.cs : Since it does not support XML declaration
its encoding is limited to utf16 and utf8. Null argument check.
Modified: trunk/olive/class/System.Runtime.Serialization/System.Xml/ChangeLog
===================================================================
--- trunk/olive/class/System.Runtime.Serialization/System.Xml/ChangeLog
2008-02-08 13:28:20 UTC (rev 95238)
+++ trunk/olive/class/System.Runtime.Serialization/System.Xml/ChangeLog
2008-02-08 13:34:51 UTC (rev 95239)
@@ -1,3 +1,8 @@
+2008-02-08 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlDictionaryWriter.cs : Since it does not support XML declaration
+ its encoding is limited to utf16 and utf8. Null argument check.
+
2007-11-27 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlDictionaryWriter.cs : WriteNode() is override, not new.
Modified:
trunk/olive/class/System.Runtime.Serialization/System.Xml/XmlDictionaryWriter.cs
===================================================================
---
trunk/olive/class/System.Runtime.Serialization/System.Xml/XmlDictionaryWriter.cs
2008-02-08 13:28:20 UTC (rev 95238)
+++
trunk/olive/class/System.Runtime.Serialization/System.Xml/XmlDictionaryWriter.cs
2008-02-08 13:34:51 UTC (rev 95239)
@@ -102,10 +102,7 @@
public static XmlDictionaryWriter CreateTextWriter (
Stream stream)
{
- XmlWriterSettings s = new XmlWriterSettings ();
- s.OmitXmlDeclaration = true;
- s.Encoding = new UTF8Encoding (false);
- return CreateDictionaryWriter (XmlWriter.Create
(stream, s));
+ return CreateTextWriter (stream, Encoding.UTF8);
}
public static XmlDictionaryWriter CreateTextWriter (
@@ -117,6 +114,20 @@
public static XmlDictionaryWriter CreateTextWriter (
Stream stream, Encoding encoding, bool ownsStream)
{
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+ if (encoding == null)
+ throw new ArgumentNullException ("encoding");
+
+ switch (encoding.CodePage) {
+ case 1200:
+ case 1201: // utf-16
+ case 65001: // utf-8
+ break;
+ default:
+ throw new XmlException (String.Format ("XML
declaration is required for encoding code page {0} but this XmlWriter does not
support XML declaration.", encoding.CodePage));
+ }
+
XmlWriterSettings s = new XmlWriterSettings ();
s.Encoding = encoding;
s.CloseOutput = ownsStream;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches