我有一个字符串(从CDATA元素),其中包含的XML描述。我需要去$ C C此字符串$成显示正确使用C#字符的新字符串
现有的字符串:
&放大器; LT; XML版本=1.0编码=UTF-8独立=是与放大器; GT;&放大器; LT; myreport xmlns="http://test.com/rules/client"><admin><ordernumber>123</ordernumber><state>NY</state></report></myreport>
字符串通缉:
&LT; XML版本=1.0编码=UTF-8独立=是&GT?;
&LT; myreport的xmlns =http://test.com/rules/client&GT;
<admin><ordernumber>123</ordernumber><state>NY</state></report></myreport>
解决方案
看HttpUtility.HtmlDe$c$c方法。
I have a string (from a CDATA element) that contains description of XML. I need to decode this string into a new string that displays the characters correctly using C#
Existing String:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><myreport xmlns="http://test.com/rules/client"><admin><ordernumber>123</ordernumber><state>NY</state></report></myreport>
String Wanted:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<myreport xmlns="http://test.com/rules/client">
<admin><ordernumber>123</ordernumber><state>NY</state></report></myreport>
解决方案
Look at HttpUtility.HtmlDecode
method.