homepage Welcome to WebmasterWorld Guest from 50.16.112.199
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
Forum Library, Charter, Moderators: bill & werty

RSS, ATOM, and Related Technologies Forum

    
ERROR with HTML tags within RSS
How to convert html into xhtml in php to display in RSS feed?
nil111

5+ Year Member



 
Msg#: 3969056 posted 8:33 am on Aug 10, 2009 (gmt 0)

I generate my RSS feed using php and they work fine with data without any html(data is dynamically dispayed from db).

When I try to display data with html tags like '<br>' the data is not displayed. I tried with some test xhtml data and it works fine.

Is there any way I can convert html into xhtml or any other solution to this?

I'm tryin out the 'Tidy' utility in PHP. but ur sujjestions are valued.

thanks in advance..

 

bill

WebmasterWorld Administrator bill us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3969056 posted 3:01 am on Aug 16, 2009 (gmt 0)

RSS is an XML file. It doesn't contain any HTML or XHTML per se. Entity-encoded HTML is allowed in the <description>. There are some examples [cyber.law.harvard.edu] provided at the RSS 2.0 Specification [cyber.law.harvard.edu].

nil111

5+ Year Member



 
Msg#: 3969056 posted 9:17 am on Aug 17, 2009 (gmt 0)

wel i figured out that the issue is with embedding html within xml.

i tried including xsl. but didnt work.

bill

WebmasterWorld Administrator bill us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3969056 posted 1:03 am on Aug 18, 2009 (gmt 0)

Where are you embedding this HTML? Are you using the entity encoding mentioned above?

Keep in mind that an RSS feed isn't meant to be presentational. You don't generally lay it out and design it like a web page. It's mainly for publishing data. If you want presentation, then make a web page.

nil111

5+ Year Member



 
Msg#: 3969056 posted 3:51 am on Aug 18, 2009 (gmt 0)

thanks for the reply. well the data displayed in the description tag of the rss field is input by the users through a wysiwyg editor. so i can help the fact that the data to be displayed has html(say like tables). is there a solution for this?

nil111

5+ Year Member



 
Msg#: 3969056 posted 3:52 am on Aug 18, 2009 (gmt 0)

above rss field = rss feed :)

nil111

5+ Year Member



 
Msg#: 3969056 posted 3:53 am on Aug 18, 2009 (gmt 0)

and i meant to say i cant help the fact that the data has html. thanks

bill

WebmasterWorld Administrator bill us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3969056 posted 8:04 am on Aug 18, 2009 (gmt 0)

RSS 2.0 requires that you entity-encode all HTML in a feed (as per above). You would have to use a routine that parsed your input and then output entity-encoded HTML tags.

nil111

5+ Year Member



 
Msg#: 3969056 posted 8:08 am on Aug 18, 2009 (gmt 0)

thanks for the reply. will try it out n post my status. thnx..

nil111

5+ Year Member



 
Msg#: 3969056 posted 10:05 am on Aug 19, 2009 (gmt 0)

i used the PHP Function - htmlspecialchars() before outputting the html inside <description> tag and it works fine now. thnks for ur help

bill

WebmasterWorld Administrator bill us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3969056 posted 2:50 am on Aug 20, 2009 (gmt 0)

That's great news. Thanks for following up with your solution!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved