Reputation: 16529
I am storing some html inside an xml document similar to this:
<news>
<item>
<title>some title</title>
<story>some text<![CDATA[<p/>]]> some more text</story>
</item>
</news>
I read the xml into a model object that is used in an MVC 3 view with razor syntax. Everything displays fine except the html that I have in the CData sections is printed to the screen as is similar to this:
some title
some text<p/>
some more text
My view looks like this:
<h2>@Model.Title</h2>
<p>
@Model.Story
</p>
but obviously i'm missing something on the rendering of the story. I even tried doing a @HttpUtility.HtmlDecode(Model.Story)
but that gave me the same result.
How can I get it to render this?
some title
some text
some more text
Upvotes: 1
Views: 2536