开发者

Decode XML returned by a webservice (< and > are replaced with &lt; and &gt)? [duplicate]

This question already has answers here: 开发者_如何学Go Closed 10 years ago.

Possible Duplicate:

How to decode string to XML string in C#

I'm calling a webservice which returns XML. If I'm using SOAP, all is fine, I get valid XML back. If however I use POST to get the return value, the XML arrives encoded as the content of the response. This means, all < and > are replaced with &lt; and &gt;.

Is there a way to convert the string back into valid XML? I don't want to use a RegEx or to replace manually since I'm sure that there are a couple of other characters that have been encoded besides the < and >.

Framework is .NET 3.5


You can use HttpServerUtility.HtmlDecode(encodedString) to return the decoded string.

Appropriate msdn link HtmlDecode


For some reason HttpServerUtility.HtmlDecode is not exist for me.

Try HttpUtility.HtmlDecode to solve this problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜