标签:bsp iter stream str contain orm for end 报文
格式化XML
public static string FormatXML(string XMLstring) { //校验是否是XML报文 if (!XMLstring.Contains("<?xml version")) return XMLstring; XmlDocument document = new XmlDocument(); document.LoadXml(XMLstring); MemoryStream memoryStream = new MemoryStream(); XmlTextWriter writer = new XmlTextWriter(memoryStream, null) { Formatting = Formatting.Indented//缩进 }; document.Save(writer); StreamReader streamReader = new StreamReader(memoryStream); memoryStream.Position = 0; string xmlString = streamReader.ReadToEnd(); streamReader.Close(); memoryStream.Close(); return xmlString; }
标签:bsp iter stream str contain orm for end 报文
原文地址:https://www.cnblogs.com/code1992/p/10704928.html