CSharp examples for System.Xml:XML Document
Method to convert a XmlDocument to string.
// All rights reserved. using System.Diagnostics; using System.Collections.Specialized; using System.Xml; using System.Data; using System;/* ww w . j a va 2 s.c om*/ public class Main{ /// ----------------------------------------------------------------------------- /// <summary> /// Method to convert a XmlDocument to string. /// </summary> /// <param name="xmlDoc">XmlDocument that will be converted to string.</param> /// <returns>A xml formatted string.</returns> /// ----------------------------------------------------------------------------- public static string DocumentToString( XmlDocument xmlDoc ) { System.Text.StringBuilder sb = new System.Text.StringBuilder( "" ); System.IO.StringWriter sw = new System.IO.StringWriter( sb ); xmlDoc.Save( sw ); return sw.ToString(); } }