EDN Admin
Well-known member
Im writing a XML file to a MemoryStream using the following logic,
<span style=" MemoryStream ms = new MemoryStream();<br/>
XmlTextWriter writer = new XmlTextWriter(ms, null);<br/>
writer.WriteStartElement("someElement");<br/>
writer.WriteAttributeString("xmlns", null, http://something/" target="_blank" title="http://something/ <span style=" "http://something <span style=" ");<br/>
writer.WriteAttributeString("xmlns", "xsi", null, http://www.w3.org/2001/XMLSchema-instance" target="_blank" title="http://www.w3.org/2001/XMLSchema-instance <span style=" "http://www.w3.org/2001/XMLSchema-instance <span style=" ");<br/>
<span style=" writer.WriteEndElement();<br/>
Etc, Etc...<br/>
<br/>
ms.Position = 0;<br/>
StreamReader sr = new StreamReader(ms);<br/>
Console.WriteLine(sr.ReadToEnd());
The mstream needs to be 2004 characters long. I know because I first wrote to a file to make sure I had the XML right. After changing the one line from;
XmlTextWriter writer = new XmlTextWriter(xmlfile, Encoding.UTF8)
to
XmlTextWriter writer = new XmlTextWriter(ms, null);
the stream is correct up to 1024 charcters. Why does it stop after 1024 charcters?
Thanks for you help in adavance.
View the full article
<span style=" MemoryStream ms = new MemoryStream();<br/>
XmlTextWriter writer = new XmlTextWriter(ms, null);<br/>
writer.WriteStartElement("someElement");<br/>
writer.WriteAttributeString("xmlns", null, http://something/" target="_blank" title="http://something/ <span style=" "http://something <span style=" ");<br/>
writer.WriteAttributeString("xmlns", "xsi", null, http://www.w3.org/2001/XMLSchema-instance" target="_blank" title="http://www.w3.org/2001/XMLSchema-instance <span style=" "http://www.w3.org/2001/XMLSchema-instance <span style=" ");<br/>
<span style=" writer.WriteEndElement();<br/>
Etc, Etc...<br/>
<br/>
ms.Position = 0;<br/>
StreamReader sr = new StreamReader(ms);<br/>
Console.WriteLine(sr.ReadToEnd());
The mstream needs to be 2004 characters long. I know because I first wrote to a file to make sure I had the XML right. After changing the one line from;
XmlTextWriter writer = new XmlTextWriter(xmlfile, Encoding.UTF8)
to
XmlTextWriter writer = new XmlTextWriter(ms, null);
the stream is correct up to 1024 charcters. Why does it stop after 1024 charcters?
Thanks for you help in adavance.
View the full article