I've been experimenting with writing XML to a file but I'm starting to realize that I need to write it to a stream instead. Having never used streams before I'm not sure how to go about doing this. All of the code examples I've seen just write XML to a file.<BR><BR>If someone could point me in the right direction it would be much appreciated.<BR><BR>Cheers,<BR><BR>masmithWell, I figured out how to accomplish this thanks to an old post from topramen: http://www.aspmessageboard.com/forum/showMessage.asp?F=36&M=268917&P=1<BR><BR>You can use the StringBuilder and StringWriter objects to write XML to a string.<BR><BR>Dim reader as XmlTextReader = nothing <BR>Dim writer as XMLTextWriter<BR> <BR>Dim strBuilder as New StringBuilder<BR>Dim strWriter As New StringWriter(strBuilder)<BR><BR> Try <BR> <BR> writer = New XMLTextWriter(strWriter) <BR> writer.WriteStartDocument<BR> writer.Formatting = Formatting.None<BR> <BR> writer.WriteStartElement("ARCXML")<BR> writer.WriteAttributeString("version", "1.1") <BR> writer.WriteStartElement("REQUEST")<BR> writer.WriteStartElement("GET_IMAGE")<BR> writer.WriteStartElement("PROPERTIES")<BR> writer.WriteStartElement("ENVELOPE")<BR> writer.WriteAttributeString("minx", xMin.Value)<BR> writer.WriteAttributeString("miny", yMin.Value)<BR> writer.WriteAttributeString("maxx", xMax.Value)<BR> writer.WriteAttributeString("maxy", yMax.Value)<BR> writer.WriteEndElement() <BR> writer.WriteStartElement("IMAGESIZE")<BR> writer.WriteAttributeString("width", widthMapPx)<BR> writer.WriteAttributeString("height", heightMapPx)<BR> writer.WriteEndElement() <BR> writer.WriteStartElement("LEGEND") <BR> writer.WriteAttributeString("font", "Arial")<BR> writer.WriteAttributeString("layerfontsize", "12")<BR> writer.WriteAttributeString("valuefontsize", "11")<BR> writer.WriteAttributeString("width", width)<BR> writer.WriteAttributeString("height", height)<BR> writer.WriteEndElement() <BR> writer.WriteEndElement()<BR> writer.WriteStartElement("DRAW")<BR> writer.WriteAttributeString("map", "false")<BR> writer.WriteEndElement()<BR> writer.WriteEndElement()<BR> writer.WriteEndElement()<BR> writer.WriteEndElement()<BR> <BR> writer.Flush<BR><BR> <BR> Catch ex as Exception<BR> Response.Write("Error accessing XML file")<BR> Finally<BR> writer.Close<BR> End Try <BR> <BR> axlRequest = strBuilder.ToString()<BR><BR>