+2006-04-05 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlWriter.cs : Create(StringBuilder,XmlWriterSettings) was missing
+ settings argument to pass another .ctor().
+ * XmlWriterSettings.cs : set_NewLineChars() should reject null.
+
2006-04-03 Boris Kirzner <borisk@mainsoft.com>
* XmlException.cs: fix .net soap serialization compatibility.
return Create (builder, null);
}
- [MonoTODO ("NewLineHandling/OutputMethod")]
public static XmlWriter Create (Stream stream, XmlWriterSettings settings)
{
- // FIXME: this might result in encoding null reference
Encoding enc = settings != null ? settings.Encoding : Encoding.UTF8;
return Create (new StreamWriter (stream, enc), settings);
}
- [MonoTODO ("NewLineHandling/OutputMethod")]
public static XmlWriter Create (string file, XmlWriterSettings settings)
{
- // FIXME: this might result in encoding null reference
Encoding enc = settings != null ? settings.Encoding : Encoding.UTF8;
return Create (new StreamWriter (file, false, enc), settings);
}
- [MonoTODO ("NewLineHandling/OutputMethod")]
public static XmlWriter Create (StringBuilder builder, XmlWriterSettings settings)
{
- return Create (new StringWriter (builder), null);
+ return Create (new StringWriter (builder), settings);
}
- [MonoTODO ("NewLineHandling/OutputMethod")]
public static XmlWriter Create (TextWriter writer, XmlWriterSettings settings)
{
return CreateTextWriter (writer, settings);
}
- [MonoTODO ("NewLineHandling/OutputMethod")]
public static XmlWriter Create (XmlWriter writer, XmlWriterSettings settings)
{
if (settings == null)
// It affects only on XmlTextWriter
public string NewLineChars {
get { return newLineChars; }
- set { newLineChars = value; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ newLineChars = value;
+ }
}
// It affects only on XmlTextWriter
+2006-04-05 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlWriterSettingsTest.cs : added tests on set_Encoding(),
+ set_NewLineChars() and OmitXmlDeclaration.
+
2006-03-08 Atsushi Enomoto <atsushi@ximian.com>
* XmlReaderCommonTests.cs : Added tests for ReadContentAsString() and
w.Close ();
AssertEquals (output, sw.ToString ());
}
+
+ [Test]
+ public void SetEncodingNull ()
+ {
+ // null is allowed.
+ new XmlWriterSettings ().Encoding = null;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void NewLineCharsNull ()
+ {
+ new XmlWriterSettings ().NewLineChars = null;
+ }
+
+ [Test]
+ public void CreateOmitXmlDeclaration ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ // Even if XmlWriter is allowed to write fragment,
+ // DataContractSerializer never allows it to write
+ // content in contentOnly mode.
+ XmlWriterSettings settings = new XmlWriterSettings ();
+ settings.OmitXmlDeclaration = true;
+ //settings.ConformanceLevel = ConformanceLevel.Fragment;
+ XmlWriter w = XmlWriter.Create (sb, settings);
+ w.WriteStartElement ("root");
+ w.WriteEndElement ();
+ w.Flush ();
+ AssertEquals ("<root />", sb.ToString ());
+ }
}
}
#endif