homepage Welcome to WebmasterWorld Guest from 54.204.249.184
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
Forum Library, Charter, Moderators: bill & werty

RSS, ATOM, and Related Technologies Forum

    
HTML tags in rss feeds?
Is this possible and "legal"
coachm




msg:3752046
 4:33 pm on Sep 25, 2008 (gmt 0)

I'm automating a feed that contains updates on my web site, and the way it is set up it uses html code that is embedded in some of the items take from my website. (like simple tags -- paragraphs.

When it gets parsed it spits out errors or stops at the first illegal tag, suggesting to me such things aren't allowed. Is there a way to have tags embedded (since I can't remove them) and have things work?

Thanks.

 

bill




msg:3752300
 1:02 am on Sep 26, 2008 (gmt 0)

Does the feed validate? [validator.w3.org]

Where are these HTML tags showing up?
Does a <description> element contain HTML markup?

If you need HTML tags in the feed itself you should use some HTML Character Entity Encoding. For example using the <BR> tag:
<description>Blah blah blah blah blah blah blah blah &lt;BR&;gt; blah blah blah blah blah blah.</description>

[edited by: bill at 12:21 am (utc) on Dec. 17, 2008]

MichaelBluejay




msg:3806743
 11:20 am on Dec 13, 2008 (gmt 0)

I have the same question. From what I can gather, HTML tags aren't allowed inside the <description></description> tags. If I'm delivering a long article via RSS, I'd like to use <p> tags to break up the content, and I see that some news feeds do the same thing, and RSS readers seem to understand that. But the feed won't pass validation if I use <p> tags.

Similarly, I'd like to link to other content from my articles with <a href> tags, but that also kills validation. I think my options are:

(1) Don't use any tags, and have annoying long articles without breaks or links.
(2) Use <p> and <a> tags, and don't be concerned that the feed doesn't validate.

Is this correct?

bill




msg:3808294
 12:58 am on Dec 16, 2008 (gmt 0)

Right, you encode the tags.

&lt;p&gt; = <p>
&lt;/p&gt; = </p>

MichaelBluejay




msg:3808587
 2:38 pm on Dec 16, 2008 (gmt 0)

I'm sorry, I misunderstood. I thought you were saying to use encoding if I want the user to be able to see the tags, if, for example, I'm writing an article about HTML. I tried encoding the tags and they work great, thanks.

But this begs the question: What if I *do* want the user to see the tags. On an HTML page &lt; will show the user a < sign. How do I show the < and > signs in an RSS feed?

bill




msg:3809131
 12:48 am on Dec 17, 2008 (gmt 0)

XML has the following entity references:
  • &amp; (& or "ampersand")
  • &lt; (< or "less than")
  • &gt; (> or "greater than")
  • &apos; (' or "apostrophe")
  • &quot; (" or "quotation mark")

    You would use those codes in lieu of the characters in your feed. The HTML tags that use these characters are parsed by the system displaying the feed.

  • MichaelBluejay




    msg:3809175
     2:14 am on Dec 17, 2008 (gmt 0)

    Well, in my test the characters didn't show up. I included the string "<manchu>" in a description but it didn't. show up. Perhaps naked < and > characters will show up if they don't look like tags, but if everything that looks like a tag tries to get parsed as such, I think that means that I can't have an article about HTML tags, because there's no way to display things like <p> to the user. Is that right?

    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