Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 723
Krumelur Avatar asked Feb 15 '11 15:02

Krumelur


2 Answers

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

Appropriate msdn link HtmlDecode

like image 52
msarchet Avatar answered Sep 30 '22 12:09

msarchet


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

Try HttpUtility.HtmlDecode to solve this problem.

like image 31
Hasan Savran Avatar answered Sep 30 '22 14:09

Hasan Savran