PC Review


Reply
Thread Tools Rate Thread

xmlnode.writeto > memorystream gets truncated

 
 
Kristofer Andersson
Guest
Posts: n/a
 
      25th Nov 2004
I have a weird problem. I write a XmlNode to a MemoryStream and the
data gets truncated at exactly 12k. The XmlNode and its children are
much larger than that but it always get cut at 12k.

Sample code:
Dim stream As New System.IO.MemoryStream
Dim writer As New XmlTextWriter(stream, Nothing)
myNode.WriteTo(writer)
writer = Nothing
stream.Position = 0
Debug.Write stream.Length

I can't see anything wrong in what I am doing...?
 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      25th Nov 2004
Kristofer Andersson <(E-Mail Removed)> wrote:
> I have a weird problem. I write a XmlNode to a MemoryStream and the
> data gets truncated at exactly 12k. The XmlNode and its children are
> much larger than that but it always get cut at 12k.
>
> Sample code:
> Dim stream As New System.IO.MemoryStream
> Dim writer As New XmlTextWriter(stream, Nothing)
> myNode.WriteTo(writer)
> writer = Nothing
> stream.Position = 0
> Debug.Write stream.Length
>
> I can't see anything wrong in what I am doing...?


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
Kristofer Andersson
Guest
Posts: n/a
 
      26th Nov 2004
(E-Mail Removed) (Kristofer Andersson) wrote in message news:<(E-Mail Removed)>...
> I have a weird problem. I write a XmlNode to a MemoryStream and the
> data gets truncated at exactly 12k. The XmlNode and its children are
> much larger than that but it always get cut at 12k.
>
> Sample code:
> Dim stream As New System.IO.MemoryStream
> Dim writer As New XmlTextWriter(stream, Nothing)
> myNode.WriteTo(writer)
> writer = Nothing
> stream.Position = 0
> Debug.Write stream.Length
>
> I can't see anything wrong in what I am doing...?


Found it - before releasing the XmlTextWriter I had to flush it using
writer.Flush().
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.Xml.XmlNode to Office.Interop.Word.XMLNode farseer Microsoft C# .NET 0 17th Oct 2005 11:49 PM
problems with MemoryStream.WriteTo(Response.OutputStream) Zoury Microsoft ASP .NET 3 4th Aug 2005 04:08 PM
problems with MemoryStream.WriteTo(Response.OutputStream) Zoury Microsoft Dot NET 3 4th Aug 2005 04:08 PM
xmlNode.InnerText vs. xmlNode.Value Dan Microsoft C# .NET 3 29th Aug 2004 03:26 AM
writeto csv file Mei Qin Microsoft ASP .NET 3 15th Jun 2004 02:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:37 PM.