加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml – 我可以在JSON中提供RSS吗?

发布时间:2020-12-16 07:53:33 所属栏目:百科 来源:网络整理
导读:我正在编写一个RSS Feed(为了好玩),并且正在查看规范 here. RSS is a dialect of XML. All RSS files must conform to the XML 1.0 specification,as published on the World Wide Web Consortium (W3C) website. 显然这意味着如果我选择JSON选项,我不会提供
我正在编写一个RSS Feed(为了好玩),并且正在查看规范 here.

RSS is a dialect of XML. All RSS files must conform to the XML 1.0 specification,as published on the World Wide Web Consortium (W3C) website.

显然这意味着如果我选择JSON选项,我不会提供“纯粹的”RSS.也就是说,如果我符合规范的其余部分,(定制)读者有可能解析它吗?

换句话说,如果我符合规范,但使用JSON而不是XML是一个可用的RSS提要?

编辑
我不知道我自己清楚了.
没有涉及XML.我想使用JSON写一些类似于RSS(这是XML)的东西.显然,这样的一个feed的读者需要被编写来了解JSON格式.
我想知道这是否已经完成了.是否有这样的服务饲料?是否有可以汇总/了解此格式的程序.在这种情况下,RSS规范(无XML部分)是否符合要求?

RG

{
"title":"example.com","link":"http://www.example.com/","description":"Awesome news about junk","items":[
    {
        "title":"An article","link":"http://www.example.com/an-article","descrition":"Some sample text here","pubDate":"2008-10-27 11:06 EST","author":"example author",},{
        "title":"Second","link":"http://www.example.com/SEOnd","pubDate":"2008-10-25 23:20 EST","author":"author mcauthor",{
        "title":"third article","link":"http://www.example.com/third-article","pubDate":"2008-10-25 23:18 EST","author":"some other author",}
]
}
我相信这已经完成了.

看看这个jQuery扩展:jFeed – RSS/ATOM feed parser

jQuery.getFeed(options);

选项:

>网址:
>数据:
>成功:

例:

jQuery.getFeed({
       url: 'rss.xml',success: function(feed) {
           alert(feed.title);
       }
   });

请注意,在这种情况下,’feed’将是一个javascript对象.如果你想使用JSON传递这个,你可以使用javascript JSON utility.

例:

var myJSONText = JSON.stringify(feed);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读