我有一个包含多个属性的 XML 文档,每个属性都有一个摘要描述节点。摘要描述节点有时包含
我希望用于在页面上实际创建换行符的 html 标记,但这些
标记当前显示为文本。我目前在控制中使用 XDocument 来获取 summaryDescription 节点的值,然后通过视图模型将其传递给视图。
XML
<summaryDescription>
A very spacious first floor four bedroom apartment situated in a convenient location. The apartment has a very impressive accommodation comprising main entrance foyer leading to hall, formal lounge, well appointed kitchen breakfast area and TV common room, family bathroom and en-suite shower room.<br/><br/>
</summaryDescription>
控制器
var query = (from props in xml.Descendants("property")
select new PropertyResult
{
Description = props.Element("summaryDescription").Value,
PriceText = props.Element("pricetext").Value,
Image = "http://www.dezrez.com/estate-agent-software/ImageResizeHandler.do?&photoID=1&AgentID=1239&BranchID=1976&Width=500&PropertyId=",
}).ToArray();
return View(new ResultsViewModel { Property = query });
如您所见,summaryDescription xml 节点的末尾有两个换行符,但它们当前在页面上显示为文本。如果有人可以帮助我强制页面将
标签视为 html 标签,我将不胜感激。
提前致谢!