[Mono-dev] MS/Mono XmlWriter incompatibility

Atsushi Eno atsushi at ximian.com
Mon Feb 13 22:30:37 EST 2006


Luca wrote:
> Il Mon, Feb 13, 2006 at 11:47:23PM +0100, Vincent Daron ha scritto: 
>> <stream:stream version="1.0" to="me at test.com" from="server" 
>> xmlns="jabber:client">
>>
>> aWriter.WriteStartDocument();
>> aWriter.WriteStartElement("stream", 
>> "stream","http://etherx.jabber.org/streams");
>> aWriter.WriteAttributeString("version", "1.0");
>> aWriter.WriteAttributeString("from", "me at test.com");
>> aWriter.WriteAttributeString("to", "server");
>> aWriter.WriteAttributeString("xmlns", theXmlNamespace);
> 
> I think that you should add:
> 
> aWrite.WriteEndElement();
> 
> instead of the empty string.

I think the code is intended to not close the element.

However there is a couple of difference between the code and
the code does not reproduce the "expected" result.

I have 2.0.50727.42 in Windows XP but Vincent might have a different
.NET 2.0 (there used to be a guy who wrote tests under Windows
2003 server and claimed that he uses the correct 1.1.4322 version,
so .NET frameworks which have the identical version differ
depending on the OS.

Those who really want to "flush" XmlTextWriter (and works fine in
CLI 1.x) should use WriteCData("") which causes significant (but
still empty) output i.e. <![CDATA[]]>. WriteString() is explicitly
designed to ignore an empty string (both under .NET and Mono).

Atsushi Eno



More information about the Mono-devel-list mailing list