its*_*lur 3 c# xml html-entities
我在 Web 服务作为类型返回的 XML 中有几个 HTML 实体XmlDocument。在应用 XSLT 转换之前,我需要将它们替换为等效的 Unicode 字符。
XML 片段
<ics>
<record>
<metadata>
<meta name="Abstract" content="In the series of compounds observed after effect of &#947;-quanta"/>
</metadata>
</record>
</ics>
Run Code Online (Sandbox Code Playgroud)
我正在使用 C# 和 .Net 4.0。我尝试使用上述 XmlDocument 的HttpUtility.HtmlDecode属性OuterXml,但它不会将 HTML 实体转换为 Unicode。
如何才能实现这一目标?
编辑:
我看到应用 HtmlDecode 一旦&#947;到达γ. 如果我再次应用它,我会得到所需的 Unicode。
还有更好的方法吗?
WebUtility.HtmlDecode在.NET 4.0中使用
另外,&#947;解码为γ逐字,而不是Unicode 字符\xce\xb3。主要问题是您的“HTML”不正确。您必须执行两次才能获得伽马字符。
| 归档时间: |
|
| 查看次数: |
2260 次 |
| 最近记录: |