SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    PHP Guru lampcms.com's Avatar
    Join Date
    Jan 2009
    Posts
    921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Q about RSS2 specifications

    Hello!

    I am wondering, is it allowed for an 'item' tag in rss2 feed to have properties?

    I need to add additional info to my articles in my RSS feed, like item's "weight" and "expiration", so I was thinking to adding these as properties of 'item', like this:
    <item weight="2" expiration="10-11-2009">

    all other usual tags here

    </item>

    Is this allowed or will it cause problems in RSS parsers? Is there a better way to do this?

  2. #2
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    The RSS specification is exactly that, a specification for a language, adding attributes which are not part of the initial model may cause undesirable results and for sure your code will not validate, if you want to give values which can be affected by behavior, why not use the class tag (you can have multiple classes per element) so you could have class="weight-2 expire-10_11_2009" (if that is useful), I am not sure why you would want weight or an expiry tag because you arent going to be able to override the reader behavior by default.

  3. #3
    PHP Guru lampcms.com's Avatar
    Join Date
    Jan 2009
    Posts
    921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you mean by class? I thought class was an html attribute, and we are talking about RSS2

    Now the reason why I need these extra tags is because I am using my own site's RSS feed for generating site's HTML. Basically I am developing a website that uses XML + XSL template. For the XML part I am using the RSS feed. This way the rss feed serves 2 purposes - it can be used by any feed reader as a feed and it is also used by visitors to my site as a source of XML. The XSL template then has instructions how to present it. The 'weight' and 'expiration' are used by my XSL template. So for example, the XSL template may have instructions to NOT show expired announcement at all, and it can have instructions to sort the list of items by weight.

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Can't use the class either if you want it to pass RSS muster--XML!=XHTML.

    What you want to do here is declare your own xml schema and then attach that to the RSS data using your own namespace.

  5. #5
    PHP Guru lampcms.com's Avatar
    Join Date
    Jan 2009
    Posts
    921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99 View Post
    Can't use the class either if you want it to pass RSS muster--XML!=XHTML.

    What you want to do here is declare your own xml schema and then attach that to the RSS data using your own namespace.
    Very good. That's what I thought also.

  6. #6
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Yes sorry, I was mistaken in the implementaton of XML stylesheets through RSS, as mentioned above the use of XML-Schema and a namespace would be able to do what you want


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •