Wednesday, October 11, 2006 4:01 AM admin

XmlDocument to Byte[]

1
2
3
4
5
6
7
8
9
StringWriter sw = new StringWriter();
XmlTextWriter xw = new XmlTextWriter(sw);

// Save Xml Document to Text Writter.
doc.WriteTo(xw);
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();

// Convert Xml Document To Byte Array.
byte[] docAsBytes = encoding.GetBytes(sw.ToString());

Filed under: ,

Comments

No Comments