protected string FormatXml(string source)
{
StringBuilder sb = new StringBuilder();
XmlTextWriter writer = null;
try
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(source);
writer = new XmlTextWriter(new StringWriter(sb));
writer.Formatting = Formatting.Indented;
doc.WriteTo(writer);
}
finally
{
if (writer != null) writer.Close();
}
return sb.ToString();
}
{
StringBuilder sb = new StringBuilder();
XmlTextWriter writer = null;
try
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(source);
writer = new XmlTextWriter(new StringWriter(sb));
writer.Formatting = Formatting.Indented;
doc.WriteTo(writer);
}
finally
{
if (writer != null) writer.Close();
}
return sb.ToString();
}