1

Followed http://damieng.com/blog/2010/04/26/creating-rss-feeds-in-asp-net-mvc to create RSS for my blog. Everything fine except html tags in xml document. Typical problem:

<br /> 

insted of

<br />

Normally I would use

@HtmlRaw()

or

MvcHtmlString()

But how can I fix it in XML document created with SyndicationFeed?

Edit: Ok, I'm starting to think that my question is pointless. Should I just leave my RSS as it is?

1
  • 1
    Unless your posts are fully valid XHTML, that behavior is correct and necessary. Commented Feb 26, 2012 at 17:24

2 Answers 2

1

With the XML element, you can wrap the text with your HTML in it in as a CDATA section:

<![CDATA[ 

   your html


]]>

I don't recommend doing that, however.

Sign up to request clarification or add additional context in comments.

Comments

0

wrap the text in side the CDATA

var xml= '<person><name><![CDATA[<h1>john smith</h1>]]></name></person>',
    xmlDoc = $.parseXML( xml ),
    $xml = $( xmlDoc ),
    $title = $xml.find( "name" );


$($title.text()).appendTo("body");

DEMO

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.