[Mono-dev] XmlTextWriter: order of namespace declarations

Lluis Sanchez lluis at ximian.com
Thu Feb 9 10:56:06 EST 2006


Hi,

IMHO, the rule "if something works don't touch it" applies here. Maybe
we just need smarter unit tests.

Lluis.

El jue, 09-02-2006 a las 10:43 +0100, Gert Driesen escribió:
> Hi,
> 
> Apparently the order in which namespace declarations are written by
> Xml(Text)Writer differs between Mono and MS.NET.
> 
> I know this is very much implementation specific, and the fact that the
> order is different in Mono is definitely not a bug.
> 
> However, this makes it difficult to write unit tests that pass on both Mono
> and MS.NET for parts of Mono where XmlTextWriter is used internally.
> 
> To reproduce this "issue" (its not a bug, I know), compile and execute the
> following code snippet:
> 
> using System;
> using System.IO;
> using System.Xml;
> 
> public class EntryPoint
> {
> 	static void Main ()
> 	{
> 		StringWriter sw = new StringWriter ();
> 
> 		XmlTextWriter xtw = new XmlTextWriter (sw);
> 		xtw.WriteStartElement ("x", "some:urn");
> 		xtw.WriteAttributeString (null, "type",
> "http://www.w3.org/2001/XMLSchema-instance", "string");
> 		xtw.WriteEndElement ();
> 		xtw.Flush ();
> 
> 		Console.WriteLine (sw.ToString ());
> 	}
> }
> 
> Actual result:
> 
> <x d1p1:type="string" xmlns="some:urn"
> xmlns:d1p1="http://www.w3.org/2001/XMLSchema-instance" />
> 
> Expected result:
> 
> <x d1p1:type="string" xmlns:d1p1="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="some:urn" />
> 
> Would it be possible to change our behaviour to match that of MS.NET ?
> 
> Gert
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list