C
Chris DiPierro
It seems as if there's a hard limit in XMLTextWriter that's causing me a
headache.
If I create an XMLTextWriter from a StringWriter, once the string gets
to be about 2.5MB in length, the XMLTextWriter will OutOfMemory
exception. The simple code listed below causes this problem.
Anyone know of a workaround / solution?
private void button1_Click(object sender, EventArgs e)
{
System.IO.StringWriter sWriter = new System.IO.StringWriter();
System.Xml.XmlTextWriter xWriter = new System.Xml.XmlTextWriter(sWriter);
xWriter.WriteStartElement("Test");
string s = new string('A', 10000);
while (true)
{
xWriter.WriteStartElement("ABC");
xWriter.WriteString(s);
System.Diagnostics.Debug.WriteLine("Length: " +
sWriter.ToString().Length);
xWriter.WriteEndElement();
}
xWriter.WriteEndElement();
}
headache.
If I create an XMLTextWriter from a StringWriter, once the string gets
to be about 2.5MB in length, the XMLTextWriter will OutOfMemory
exception. The simple code listed below causes this problem.
Anyone know of a workaround / solution?
private void button1_Click(object sender, EventArgs e)
{
System.IO.StringWriter sWriter = new System.IO.StringWriter();
System.Xml.XmlTextWriter xWriter = new System.Xml.XmlTextWriter(sWriter);
xWriter.WriteStartElement("Test");
string s = new string('A', 10000);
while (true)
{
xWriter.WriteStartElement("ABC");
xWriter.WriteString(s);
System.Diagnostics.Debug.WriteLine("Length: " +
sWriter.ToString().Length);
xWriter.WriteEndElement();
}
xWriter.WriteEndElement();
}