德code XML返回一个Web服务(LT;和>替换为&放大器; LT;和&放大器; GT)?

编程入门 行业动态 更新时间:2024-10-09 18:23:19
本文介绍了德code XML返回一个Web服务(LT;和>替换为&放大器; LT;和&放大器; GT)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

可能重复:   如何去code字符串在C# XML字符串

Possible Duplicate: How to decode string to XML string in C#

我打电话一个web服务返回的XML。如果我使用SOAP,一切都很好,我得到有效的XML回来。然而,如果我使用POST得到的返回值,在XML到达EN codeD作为响应的内容。 这意味着,所有的<和>被替换为&放大器; LT; 和&放大器; GT;

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;.

有没有办法将字符串转换回有效的XML?我不想使用正则表达式或手动更换,因为我敢肯定,有一些其他的字符已经连接codeD之外的&lt;和>。

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 >.

框架是.NET 3.5

Framework is .NET 3.5

推荐答案

您可以使用 HttpServerUtility.HtmlDe code(EN codedString)返回德codeD字符串。

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

相应的MSDN链接 HtmlDe code

更多推荐

德code XML返回一个Web服务(LT;和&gt;替换为&放大器; LT;和&放大器; GT)?

本文发布于:2023-11-28 18:54:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643568.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:放大器   Web   XML   code   GT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!