Can I add my own tags in a rss item?

天涯浪子 提交于 2019-12-06 15:20:10

Yes you can - create a new namespace for your tags (it's standard XML).

An example:

<?xml version="1.0"?>
<rss version="2.0" xmlns:w="http://tempuri.org">
    <channel>
        ...
        <item>
            <title>Item title</title>
            <description>...</description>
            <w:temperature>...</w:temperature>
            <w:windspeed>...</w:windspeed>
        </item>
    </channel>
</rss>

That said, perhaps you should do a little searching first to see if there's an existing format that meets your needs. Standards == good :)

See http://www.feedforall.com/namespaces.htm, http://base.google.co.uk/support/bin/answer.py?answer=58085&hl=en_GB

Is this what you're looking for?

http://cyber.law.harvard.edu/rss/rss.html#extendingRss

I think Atom has something similar too. You can look at the spec for Atom here:

http://tools.ietf.org/rfc/rfc4287.txt

If you want an example of weather RSS feeds, you should definitely take a look at the RSS feeds that are produced by the Weather channel at http://www.weather.com

I remember using those a few years ago to generate weather widgets for a small city's website I helped produce. We would parse out the RSS feed to get the temperature and cloud coverage of our specific zip code's weather.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!