要检测xml字符串是否是在格式上符合标准,请问该如何检测,google找不到结果。
------解决方案--------------------------------------------------------
- C# code
try{ System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.LoadXml(xmlStr); return 合格}catch(Exception ex){ //不合格}
try{ System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.LoadXml(xmlStr); return 合格}catch(Exception ex){ //不合格}