开发者

RSS feed with nested items, what is the proper way?

I have a product that has multiple variations. I would like, in an RSS feed, to show this as a nested items option, but I don't know if this is valid or not:

<?xml version="1.0" encoding="US-ASCII" ?>
<rss version="2.0"
    xmlns:s="http://example.com/s">
    <channel>
        <title>Examle RSS</title>
        <link>http://www.example.com/</link>
        <description>Example Product Feed</description>
        <language>en-us</language>

        <item>
             <title>My Product</title>
             <description>An amazing item!</description>
             <item>
                 <title>A开发者_开发问答S-435</title>
                 <s:price>$34.00</s:price>
             </item>
        </item>

    </channel>
</rss>

If this isn't valid what is the best way to go about this?


It's not valid, but it's a very interesting idea.

You'd have to put the inner items in a new namespace.

And keep in mind that no one else will understand what you're doing.


The rss schema definition for an <item> does not include the option for another <item> sub-element. (http://cyber.law.harvard.edu/rss/rss.html)

If the data only needs to be consumed only by your client's proprietary parser, why not drop the RSS schema and use a custom one?

Otherwise, if it would be of some benefit to be compatible with feed readers, why not create a feed for each type of item, web 2.0 style? For example, one for product lines, one for product models and one for product makes. Better make the feeds query-able, and identify each item with a unique id.

I in fact located this thread to promote my agenda.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜