0
点赞
收藏
分享

微信扫一扫

C# ? 格式化XML方法

/// 

  /// 鯉塀晒XML圭隈
  ///
  public class UXMLFormat
  {
  public static string FormatXML(string XMLstring)
  {
  //丕刮頁倦頁XML烏猟
  if (!XMLstring.Contains("

  XmlDocument xmlDocument=GetXmlDocument(XMLstring);
  return ConvertXmlDocumentTostring(xmlDocument);
  }
  public static string ConvertXmlDocumentTostring(XmlDocument xmlDocument)
  {
  MemoryStream memoryStream=new MemoryStream();
  XmlTextWriter writer=new XmlTextWriter(memoryStream, null)
  {
  Formatting=Formatting.Indented//抹序
  };
  xmlDocument.Save(writer);
  StreamReader streamReader=new StreamReader(memor

举报

相关推荐

0 条评论