我有一个返回 struct 对象的 Web 服务,因此我得到以下 XML 字符串形式的响应。现在我需要将其加载到 XmlDocument 对象中,但如何删除字符串中的转义序列。每个“”的“\”都会导致错误。
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<Quote xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://tempuri.org/\">
<price>19656</price>
</Quote>
Use 正则表达式.Unescape http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.unescape%28v=vs.110%29.aspx method.
String unescapedString = Regex.Unescape(textString);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)