如何去code字符串在C#中的XML字符串字符串、何去、code、XML

2023-09-02 10:38:45 作者:街角丶丢幸福

我有一个字符串(从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>
 

字符串通缉:

 < XML版本=1.0编码=UTF-8独立=是&GT?;
< myreport的xmlns =htt​​p://test.com/rules/client>
<admin><ordernumber>123</ordernumber><state>NY</state></report></myreport>
 

解决方案

看HttpUtility.HtmlDe$c$c方法。

java代码 将字符串快速生成到string.xml中

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:

&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;myreport xmlns="http://test.com/rules/client"&gt;&lt;admin&gt;&lt;ordernumber&gt;123&lt;/ordernumber&gt;&lt;state&gt;NY&lt;/state&gt;&lt;/report&gt;&lt;/myreport&gt;

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.