加载中…
个人资料
小胖和猪猪
小胖和猪猪
  • 博客等级:
  • 博客积分:0
  • 博客访问:97,578
  • 关注人气:111
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

RSS学习笔记--RSS1.0规范

(2008-10-13 15:25:21)
标签:

rss

web2.0

it

分类: 计算机

RSS1.0规范
1. 核心语法向下兼容0.9。
2. 通过XML命名空间基于RDF(http://www.w3.org/TR/REC-rdf-syntax/)来扩展,这种扩展是通过modules来进行,modules包括:
A. Dublin Core:提供基本元数据元素
     <dc:publisher>The O'Reilly Network</dc:publisher>
B. Syndication: 通知聚合器RSS文档更新的频率

    <sy:updatePeriod>hourly</sy:updatePeriod>
   <sy:updateFrequency>2</sy:updateFrequency>
模块规范:
a) 符合XML命名空间,http://www.w3.org/TR/REC-xml-names/
b) 模式分简单和丰富两种
简单:
     <dc:subject>Woodworking</dc:subject>
丰富:
    <dc:subject>
        <taxo:topic rdf:about="http://dmoz.org/Arts/Crafts/Wood_Craft/Woodworking/">
            <rdf:value="Woodworking" />
        </taxo:topic>
    </dc:subject>
c) 模块尽量写成适应RDF格式
d) 日期要符合W3C标准。
e) 二级元素必须包含rdf:about属性
f) Mime类型为application/xml
g) 文件扩展名为rdf或xml
h) 编码:0.9必须是ascii,1.0支持utf-8
3. 内容格式
3.1 <?xml version="1.0"?>
语法:<?xml version="1.0"?>,XML声明,可选

 

3.2 <rdf:RDF>
语法:<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/">,声明RDF语法架构,必须。

 

3.3 <channel>
语法:<channel rdf:about="{resource}">,频道,其中resource必须是唯一的,必须。
<title>
语法:<title>{channel_title}</title>频道标题
<link>
语法:<link>{channel_link}</link>,一般是站点首页,必须。
<description>
语法:<description>{channel_description}</description>,站点简介,必须。
<image>
语法:<image rdf:resource="{image_uri}" />,站点图片,可选。
<items>
语法:<items><rdf:Seq><rdf:li resource="{item_uri}" /> ... </rdf:Seq></items>,和channel相关的文档内容,必须
<textinput>
语法:<textinput rdf:resource="{textinput_uri}" />可选
例子:
 <channel rdf:about="http://www.xml.com/xml/news.rss">
    <title>XML.com</title>
    <link>http://xml.com/pub</link>
    <description>
      XML.com features a rich mix of information and services
      for the XML community.
    </description>
    <image rdf:resource="http://xml.com/universal/images/xml_tiny.gif" />
    <items>
      <rdf:Seq>
        <rdf:li resource="http://xml.com/pub/2000/08/09/xslt/xslt.html" />
        <rdf:li resource="http://xml.com/pub/2000/08/09/rdfdb/index.html" />
      </rdf:Seq>
    </items>
    <textinput rdf:resource="http://search.xml.com" />
  </channel>

 

3.4 <image>
语法:image rdf:about="{image_uri}">,channel的HTML表述中的图片,可选
<title>
Syntax: <title>{image_alt_text}</title>
<url>
Syntax: <url>{image_url}</url>
<link>
Syntax: <link>{image_link}</link>,图片地址
示例:
<image rdf:about="http://xml.com/universal/images/xml_tiny.gif">
    <title>XML.com</title>
    <link>http://www.xml.com</link>
    <url>http://xml.com/universal/images/xml_tiny.gif</url>
  </image>

 

3.5 <item>
Syntax: <item rdf:about="{item_uri}">条目,至少一个,item_uri唯一
<title>
Syntax: <title>{item_title}</title>,条目标题
<link>
Syntax: <link>{item_link}</link>,条目URL
<description>
Syntax: <description>{item_description}</description>,条目描述。
示例:
<item rdf:about="http://xml.com/pub/2000/08/09/xslt/xslt.html">
    <title>Processing Inclusions with XSLT</title>
    <link>http://xml.com/pub/2000/08/09/xslt/xslt.html</link>
    <description>
     Processing document inclusions with general XML tools can be
     problematic. This article proposes a way of preserving inclusion
     information through SAX-based processing.
    </description>
  </item>

 

3.6 <textinput>
指向一个可递交的窗体,一般是个查询页面
Syntax: <textinput rdf:about="{textinput_uri}">
<title>
Syntax: <title>{textinput_title}</title>
<description>
Syntax: <description>{textinput_description}</description>
<name>
输入框名称
Syntax: <name>{textinput_varname}</name>
<link>
查询处理页面
Syntax: <link>{textinput_action_url}</link>
示例:
<textinput rdf:about="http://search.xml.com">
    <title>Search XML.com</title>
    <description>Search XML.com's XML collection</description>
    <name>s</name>
    <link>http://search.xml.com</link>
  </textinput>

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有