JD wrote: >> Construct an xml object in memory >> and fill it with some arbitrary data.
JD, hope this gets you started Check out the article by Marc Clifton on CodeProject "Simple Serializer" for some very cool techniques including how to get the
contents of the BaseStream object of the XmlextWriter into a string : (Marc's article has links to his other interesting work with XML and XAML)
http://www.codeproject.com/csharp/SimpleSerializer.asp
best, Bill Woodruff
dotScience
Chiang Mai, Thailand
using System;
using System.Text;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
private void createXmlInMemory()
{
XmlTextWriter theXMLTextWriter;
MemoryStream theMStream = new MemoryStream();
theXMLTextWriter = new XmlTextWriter(theMStream, new UTF8Encoding());
theXMLTextWriter.Formatting=Formatting.Indented;
theXMLTextWriter.Indentation = 8;
theXMLTextWriter.Namespaces=false;
// startDocument ...
theXMLTextWriter.WriteStartDocument();
theXMLTextWriter.WriteComment("Some comment");
// start element 1
theXMLTextWriter.WriteStartElement("Some element 1");
// start element 1.1
theXMLTextWriter.WriteStartElement("Some element 1.1");
// write out a value for element 1.1
theXMLTextWriter.WriteString("Value for object 1.1");
// close element 1.1
theXMLTextWriter.WriteEndElement();
// close element 1
theXMLTextWriter.WriteEndElement();
// end Document ...
theXMLTextWriter.WriteEndDocument();
theXMLTextWriter.Flush();
// at this point the BaseStream object of XMLTextWriter
// has the complete XML you have written ...
// do something with the data in the BaseStream here ...
theXMLTextWriter.Close();
}