Re: Encoded HTML within <description> or <content>
"ecomputerd" <ecomputerd-/[email protected]> Thu, 04 Aug 2005 10:31:18 -0000
| Newsgroups | gmane.network.syndication.rss.devel |
|---|---|
| Message-ID | <[email protected]> |
I understand the need to avoid the use of embedded html when producing a feed. But as a writer of the *client*, I have limited control over what I receive. Going back to a veriation on my original question, how do I tell the difference between a DESCRIPTION element that has embedded HTML and one that doesn't? As far as I can tell (and according to responses to the original question), both of these are valid: Case 1) DESCRIPTION element (spaces added to avoid html interpretation): & l t ; b & g t ; B i g B o l d e d T e x t & l t ; / b & g t ; f o l l o w e d b y n o n - b o l d e d t e x t Case 2) DESCRIPTION element (spaces added to avoid html interpretation): < b > B i g B o l d e d T e x t < b > f o l l o w e d b y n o n - b o l d e d t e x t For Case 2, I can throw the contents of the description element into my HTML renderer and it looks correct on the screen (i.e. it has actual bold text on the screen). For Case 1, to get it to look correct on the screen, I have to decode the HTML once, then throw it in my HTML renderer (effectively "interpreting" it twice). If both of these are valid, how can I do the right thing? How do I tell what the intent of the author is? If I design Case 2 to show up correctly on the screen, then Case 1 will look bad. If I design Case 1 to show up correctly on the screen, then Case 2 will look bad. Or will it? Case 3) A v a l i d H T M L m a r k up i s < b > f o l l o w e d b y b o l d e d t e x t a n d e n d i n g i n < / b > . Case 4) A v a l i d H T M L m a r k up i s & lt ; b & gt ; f o l l o w e d b y b o l d e d t e x t a n d e n d i n g i n & lt ; / b & gt ; . Case 5) A v a l i d H T M L m a r k up i s & a m p ; lt ; b & a m p ; gt ; f o l l o w e d b y b o l d e d t e x t a n d e n d i n g i n & a m p ; lt ; / b & a m p ; gt ; . Design for Case 1: Case 5 is correct. Design for Case 2: Case 4 is correct. If I always pre-decode and ignore greater-than and less-than signs, I might could get Case 1 and Case 2 to look correct. If I do that, then Case 5 would show up on the screen correctly, but Case 3 and Case 4 would not. Case 3 and Case 4 would both look the same on screen, they would both have the "followed by bolded text and ending in" rendered in bold text. The issue is that I am seeing both Case 1 and Case 2 "in the field" and I'm not sure how to render or pre-render. I have three choices: Choice A) Put DESCRIPTION element into HTML renderer: Case 2, Case 4 are correct Choice B) Pre-decode DESCRIPTION element, then put into HTML renderer, Case 1, Case 5 are correct. Choice C) Pre-decode DESCRIPTION element, ignore greater/less-than signs: Case 1, Case 2, Case 5 are correct. Does this make sense? Which Choice (A, B, or C) is correct? Or am I missing something? Greg Smith --- In [email protected], "Bill Kearney" <ml_yahoo@i...> wrote: > > > Non-escaped elements aren't allowed in an RSS description element. > > It's considered standard to use escaped HTML. A point to consider, > however, is you want to make sure people can actually READ your > newsfeed. This is not a web page, it's a textual feed. If you want > the widest range of readership you'd do well to avoid bothering them > with text formatting. Live without it. > > > However, a valid extension is to use: > > > > <item> > > ... > > <body xmlns='http://www.w3.org/1999/xhtml'> > > <p><b>Big Bolded Text</b></p> > > </:body> > > ... > > </item> > > Yes, in the technical sense, this is correct. But it's not something > that all RSS reader programs will know how to handle. As a result > some users won't be able to read the text. > > For all it's evils, the only reliably consistent way to put text > formatting inside the description element of an RSS item is to use > double-encoding of *very* limited HTML styling (as in, NO css). The > most reliable way, however, to make sure people can read your feed is > to avoid formatting in it entirely. Pull 'em back to your website for > all the fancy formatting. > > -Bill Kearney > Syndic8.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/rss-dev/ <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/