[Mono-bugs] [Bug 49353][Nor] New - XmlSerializer.Serialize() handles namespace parameter incorrectly

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 5 Oct 2003 15:22:19 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mathpup@mylinuxisp.com.

http://bugzilla.ximian.com/show_bug.cgi?id=49353

--- shadow/49353	2003-10-05 15:22:19.000000000 -0400
+++ shadow/49353.tmp.21869	2003-10-05 15:22:19.000000000 -0400
@@ -0,0 +1,88 @@
+Bug#: 49353
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlSerializer.Serialize() handles namespace parameter incorrectly
+
+Description of Problem: 
+ 
+When the XmlSerializer.Serialize() method is called with an 
+XmlSerializerNamespace parameter, the ns should *replace* the default 
+namespace, as it does with Rotor and is shown in the MSDN docs. Instead, Mono 
+adds the ns to the defaults. 
+ 
+ 
+Steps to reproduce the problem: 
+1. csc xml-example2.cs 
+2. clix xml-example2.exe (for Rotor) 
+3. mono xml-example2.exe (for mono) 
+ 
+ 
+Actual Results: 
+ 
+(From mono) 
+ 
+<?xml version="1.0" encoding="iso-8859-1"?> 
+<MyClass xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://
+www.w3.org/2001/XMLSchema-instance" xmlns:=""> 
+  <field>35</field> 
+</MyClass> 
+ 
+ 
+Expected Results: 
+ 
+(From Rotor) 
+ 
+<?xml version="1.0" encoding="Windows-1252"?> 
+<MyClass> 
+  <field>35</field> 
+</MyClass> 
+ 
+ 
+How often does this happen?  
+ 
+Always 
+ 
+Additional Information: 
+ 
+Test case: 
+ 
+using System; 
+using System.IO; 
+using System.Xml; 
+using System.Xml.Serialization; 
+ 
+public class MyClass 
+{ 
+    public int field = 35; 
+} 
+ 
+public class Testing 
+{ 
+    public static void Main() 
+    { 
+        MyClass m = new MyClass(); 
+            XmlSerializer serializer = new XmlSerializer(typeof(MyClass)); 
+        XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); 
+        ns.Add("", ""); 
+ 
+            serializer.Serialize(Console.Out, m, ns); 
+            Console.WriteLine(); 
+    } 
+} 
+ 
+ 
+See also the example code in the MSDN docs under Serialize(TextWriter, object, 
+XmlSerializerNamespaces)