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>
HttpUtility.HtmlDecode
from System.Web
WebUtility.HtmlDecode
from System.Net
You can use System.Net.WebUtility.HtmlDecode instead of HttpUtility.HtmlDecode
Useful if you don't want System.Web reference and prefer System.Net instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With