http://web.resource.org/rss/1.0/spec
ss1.0规范
(2005-10-19 14:41:39)
rss1.0规范
RDF Site Summary (RSS) 1.0是一个轻量级多目的可扩展元数据描述和同步(syndication)格式。RSS是对XML的一种应用,遵循w3c的RDF规范,并且通过基于xml-命名空间和/或RDF的模块进行扩展。
rss1.0核心语法
元素 | 重要性 | 结构 | 说明 | 必备属性 |
<?xml version="1.0"?> | 可选(除非指定编码) | |||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/"> | 必备(如示) | (channel, image?, item+, textinput?) | RSS1.0的最外层元素(根元素) | |
<channel rdf:about="{resource}"> | 必备 | (title, link, description, image?, items, textinput?) | 标题、简介、URL等描述channel自身的元数据 | |
<title>{channel_title}</title> | 必备 | (#PCDATA) | 最大长度40字符(建议) | |
<link>{channel_link}</link> | 必备 | (#PCDATA) | 最大长度500字符(建议),通常指向站点的主页或新闻页 | |
<description>{channel_description}</description> | 必备 | (#PCDATA) | 最大长度500字符(建议),频道内容、功能、资源的简介 | |
<image rdf:resource="{image_uri}" /> | Image元素出现时必备 | 此{image_uri}须与image元素的rdf:about的 {image_uri} 一致,将一个频道与一个图片关联 | ||
<items><rdf:Seq><rdf:li resource="{item_uri}" /> ... </rdf:Seq></items> | 必备 | 此{item_uri}须与相应的item元素的rdf:about的 {item_uri} 一致,用RDF Seq表明item之间的顺序 | ||
<textinput rdf:resource="{textinput_uri}" /> | 有textinput元素时必备 | 此{textinput_uri}须与textinput元素的rdf:about的 {textinput_uri} 一致 | ||
<image rdf:about="{image_uri}"> | 可选(有则须在channel中描述) | (title, url, link) | 频道图片,格式需多数浏览器支持,宽1-144,高1-400,建议88*31 | rdf:about |
<title>{image_alt_text}</title> | 有image元素时必备 | (#PCDATA) | 最大长度40字符(建议),用作img标签的alt属性。 | |
<url>{image_url}</url> | 有image元素时必备 | (#PCDATA) | 最大长度500字符(建议),图片的URI。 | |
<link>{image_link}</link> | 有image元素时必备 | (#PCDATA) | 最大长度500字符(建议),图片超链指向的URL,常为站点主页或新闻页面。 | |
<item rdf:about="{item_uri}"> | 不小于1个,建议1-15个 | (title, link, description?) | item的唯一标志,如果可能,{item_uri}应和link子元素的值一致,item可以是任何有uri的对象 | rdf:about |
<title>{item_title}</title> | 必备 | (#PCDATA) | 最大长度100字符(建议),item的标题。 | |
<link>{item_link}</link> | 必备 | (#PCDATA) | 最大长度500字符(建议),item的URL。 | |
<description>{item_description}</description> | 可选 | (#PCDATA) | 最大长度500字符(建议),item的简介或摘要。 | |
<textinput rdf:about="{textinput_uri}"> | 可选(有则须在channel中描述) | (title, description, name, link) | 提供一种方法提交数据到任意URL,{textinput_uri}要与link子元素的值一致,URL所对应的程序假定处理HTTP GET方法提交的数据。 | rdf:about |
<title>{textinput_title}</title> | 有textinput元素时必备 | (#PCDATA) | 最大长度40字符(建议),输入框的描述标题 | |
<description>{textinput_description}</description> | 有textinput元素时必备 | (#PCDATA) | 最大长度100字符(建议),输入框目的的简介。 | |
<name>{textinput_varname}</name> | 有textinput元素时必备 | (#PCDATA) | 最大长度500字符(建议),输入框的变量名。 | |
<link>{textinput_action_url}</link> | 有textinput元素时必备 | (#PCDATA) | 最大长度500字符(建议),表单action的URL。 |
跟rss1.0一起发布的有两个模块, 都柏林核心体系(Dublin Core) 和同步体系(Syndication).前者,上海图书馆的刘炜先生进行了翻译。
DC模块的主要内容:
命名空间定义:xmlns:dc="http://purl.org/dc/elements/1.1/"
对<channel>, <item>, <image>, and <textinput>等元素扩展了下列子元素。
<dc:title> | ( #PCDATA ) | 元素1:题名 | 应用级别:M。DC 定义为:给予资源的名称。 |
<dc:creator> | ( #PCDATA ) | 元素2:创建者 | 应用级别: O。DC定义为: 对资源内容制作负主要责任的实体。 |
<dc:subject> | ( #PCDATA ) | 元素5:主题 | 应用级别:MA。DC定义为:资源内容的论题。 |
<dc:description> | ( #PCDATA ) | 元素6:说明 | 应用级别:R。DC定义为:对资源内容的叙述。 |
<dc:publisher> | ( #PCDATA ) | 元素4:出版者 | 应用级别:O。DC定义为:负责制作可获资源的实体。 |
<dc:contributor> | ( #PCDATA ) | 元素3:其他责任者 | 应用级别:MA。DC定义为:对资源内容作出贡献的实体。 |
<dc:date> | ( #PCDATA ) [W3CDTF] | 元素7:日期 | 应用级别:MA。DC定义为:资源生命周期中关联事件的日期。 |
<dc:type> | ( #PCDATA ) | 元素8:类型 | 应用级别:O。DC定义为:资源内容的性质或类型。 |
<dc:format> | ( #PCDATA ) | 元素9:格式 | 应用级别:R。DC定义为:资源的物理或数字形式。 |
<dc:identifier> | ( #PCDATA ) | 元素10:标识符 | 应用级别:MA。DC定义为:资源的特定指向。 |
<dc:source> | ( #PCDATA ) | 元素11:来源 | 应用级别:O。DC定义为:被衍生资源的指引。 |
<dc:language> | ( #PCDATA ) | 元素12:语种 | 应用级别:MA。DC定义为:资源知识内容的语种。 |
<dc:relation> | ( #PCDATA ) | 元素13:关联 | 应用级别:O。DC定义为:相关资源的指引。 |
<dc:coverage> | ( #PCDATA ) | 元素14:覆盖范围 | 应用级别:O。DC定义为:资源内容的量度和范围。 |
<dc:rights> | ( #PCDATA ) | 元素15:权限 | 应用级别:R(如果存在债权关系)。 |
syn模块的主要内容:
命名空间: xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
对<channel>扩展下列元素
- <sy:updatePeriod> ( 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' )
- <sy:updateFrequency> ( a positive integer )
- <sy:updateBase> ( #PCDATA ) [W3CDTF]
例子:
<?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:co="http://purl.org/rss/1.0/modules/company/" xmlns:ti="http://purl.org/rss/1.0/modules/textinput/" xmlns="http://purl.org/rss/1.0/"> <channel rdf:about="http://meerkat.oreillynet.com/?_fl=rss1.0"> <title>Meerkat</title> <link>http://meerkat.oreillynet.com</link> <description>Meerkat: An Open Wire Service</description>
<dc:publisher>The O'Reilly Network</dc:publisher> <dc:creator>Rael Dornfest (mailto:rael@oreilly.com)</dc:creator> <dc:rights>Copyright © 2000 O'Reilly & Associates, Inc.</dc:rights>
<dc:date>2000-01-01T12:00+00:00</dc:date> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>2</sy:updateFrequency> <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<image rdf:resource="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg" />
<items> <rdf:Seq> <rdf:li resource="http://c.moreover.com/click/here.pl?r123" /> </rdf:Seq>
</items>
<textinput rdf:resource="http://meerkat.oreillynet.com" />
</channel>
<image rdf:about="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg"> <title>Meerkat Powered!</title>
<url>http://meerkat.oreillynet.com/icons/meerkat-powered.jpg</url> <link>http://meerkat.oreillynet.com</link> </image>
<item rdf:about="http://c.moreover.com/click/here.pl?r123">
<title>XML: A Disruptive Technology</title> <link>http://c.moreover.com/click/here.pl?r123</link> <dc:description> XML is placing increasingly heavy loads on the existing technical infrastructure of the Internet. </dc:description> <dc:publisher>The O'Reilly Network</dc:publisher>
<dc:creator>Simon St.Laurent (mailto:simonstl@simonstl.com)</dc:creator> <dc:rights>Copyright © 2000 O'Reilly & Associates, Inc.</dc:rights> <dc:subject>XML</dc:subject>
<co:name>XML.com</co:name> <co:market>NASDAQ</co:market> <co:symbol>XML</co:symbol> </item> <textinput rdf:about="http://meerkat.oreillynet.com">
<title>Search Meerkat</title> <description>Search Meerkat's RSS Database...</description> <name>s</name> <link>http://meerkat.oreillynet.com/</link>
<ti:function>search</ti:function> <ti:inputType>regex</ti:inputType> </textinput>
</rdf:RDF>