[Mono-dev] MS/Mono XmlWriter incompatibility
Vincent Daron
vdaron at ask.be
Tue Feb 14 03:43:57 EST 2006
Atsushi Eno a écrit :
> Atsushi Eno wrote:
>> 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.
Yes, I do not want to close the tag
>>
>> However there is a couple of difference between the code and
>> the code does not reproduce the "expected" result.
>
> I mean, between the code and the actual output.
>
>> 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).
>
I'm simply using Windows XP SP2 with VS2005. (v2.0.50727).
I'm using Flush it's to ensure that xml is actually sent.
I've tested with Framework 1.1 and the WriteString is effectively ignored.
It seems that the behavior changes with Framework 2.0.
I've attached a simple test app that reproduce it.
Thanks
Vincent
> I also found a nasty workaround by using WriteRaw("") under .NET
> which will be soon enabled in mono too.
>
> Atsushi Eno
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Program.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060214/49068975/attachment.pl
More information about the Mono-devel-list
mailing list