2011-07-23 95 views
0

我正在尝试将RSS源添加到我的页面中,并且我卡在了添加HTML代码的位置以及图像,换行符等正常html代码中是否有任何更改。php XML RSS html代码问题

我试图粘贴下面的代码是从维基百科:

<?xml version="1.0" encoding="UTF-8" ?> 
<rss version="2.0"> 
<channel> 
     <title>RSS Title</title> 
     <description>This is an example of an RSS feed</description> 
     <link>http://www.someexamplerssdomain.com/main.html</link> 
     <lastBuildDate>Mon, 06 Sep 2010 00:01:00 +0000 </lastBuildDate> 
     <pubDate>Mon, 06 Sep 2009 16:45:00 +0000 </pubDate> 

     <item> 
       <title>Example entry</title> 
       <description>Here is some text containing an interesting description.</description> 
       <link>http://www.wikipedia.org/</link> 
       <guid>unique string per item</guid> 
       <pubDate>Mon, 06 Sep 2009 16:45:00 +0000 </pubDate> 
     </item> 

</channel> 
</rss> 

,但我不知道从哪里把HTML代码。

回答

4

我不知道你想在RSS XML HTML代码做什么,我假设你需要在描述发送HTML格式,你可以在CDATA包裹HTML中描述元素

<description><![CDATA[" and ends with Here is some text containing an interesting description.]]></description> 
+0

我有一些大胆的文本,ul列表,图片和带有换行符的随机文本以显示在rss Feed中。 这是我主要关心的问题。我必须在CDATA中添加它们吗? – fxuser

+1

是的,你会需要CDATA所有这些 – Andreas

+0

太好了,谢谢。 – fxuser