Atom (標準)
维基百科,自由的百科全书
Atom是一對彼此相關的標準。Atom供稿格式(Atom Syndication Format)是用於網站消息來源,基于XML的文档格式;而Atom出版協定(Atom Publishing Protocol,簡稱AtomPub或APP)是用於新增及修改網路資源,基于HTTP的协议。
它借鉴了各种版本RSS的使用经验,被許多的聚合工具广泛使用在发布和使用上。Atom供稿格式設計作為RSS的替代品;而Atom出版協定用來取代現有的多種發布方式(如Blogger API和LiveJournal XML-RPC Client/Server Protocol)。而值得一提的是Google提供的多種服务正在使用Atom。Google Data API (GData) 亦基於Atom。
Atom是IETF的「建議標準」,Atom供稿格式列為RFC 4287,而Atom出版協定列為RFC 5023。
目录 |
歷史 [编辑]
Atom曾命名為「Echo」。
Atom與RSS 2.0的比較 [编辑]
当初发展Atom的动机在于广泛应用RSS 2.0时所遇到的问题。为了降低开发支持Web聚合应用的难度,下面列出Atom 1.0所克服的RSS 2.0几个主要问题(源自 [1]):
- RSS 2.0 可能包含文本或经过编码的HTML内容,同时却没有提供明确的区分办法;相比之下,Atom 则提供了明确的标签(也就是typed)。
- RSS 2.0 的 description 标签可以包含全文或摘要(尽管该标签的英文含义为描述或摘要)。Atom 则分别提供了 summary 和 content标签,用以区分摘要和内容,同时 Atom 允许在summary中添加非文本内容。
- RSS 2.0 存在多种非标准形式的应用,而 Atom 具有统一的标准,这便于内容的聚合和发现。
- Atom 有符合XML标准的命名空间,RSS 2.0 却没有。
- Atom 通过XML内置的xml:base标签来指示相对地址(URI),RSS 2.0 则无相应的机制区分相对地址和绝对地址。
- Atom 通过XML内置的xml:lang,而 RSS 採用自己的language标签。
- Atom 强制为每个条目设定唯一的ID,这将便于内容的跟踪和更新。
- Atom 1.0 允许条目单独成为文档,RSS 2.0 则只支持完整的种子文档,这可能产生不必要的复杂性和带宽消耗。
- Atom 按照RFC 3339标准(ISO 8601标准的一个子集)表示时间 ,而RSS 2.0 中没有指定统一的时间格式。
- Atom 1.0 具有在 IANA 注册了的 MIME 类型,而 RSS 2.0 所使用的 application/rss+xml 并未注册。
- Atom 1.0 标准包括一个 XML schema,RSS 2.0 却没有。
- Atom 是IETF组织标准化程序下的一个开放的发展中标准,RSS 2.0 则不属于任何标准化组织,而且它不是开放版权的。
例子 [编辑]
一个Atom文挡:
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>Example Feed</title> <subtitle>A subtitle.</subtitle> <link href="http://example.org/feed/" rel="self" /> <link href="http://example.org/" /> <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id> <updated>2003-12-13T18:30:02Z</updated> <author> <name>John Doe</name> <email>johndoe@example.com</email> </author> <entry> <title>Atom-Powered Robots Run Amok</title> <link href="http://example.org/2003/12/13/atom03" /> <link rel="alternate" type="text/html" href="http://example.org/2003/12/13/atom03.html"/> <link rel="edit" href="http://example.org/2003/12/13/atom03/edit"/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2003-12-13T18:30:02Z</updated> <summary>Some text.</summary> </entry> </feed>
Including in XHTML [编辑]
The following tag should be placed into the head of an XHTML document to provide a link to an ATOM Feed.
<link href="atom.xml" type="application/atom+xml" rel="alternate" title="Sitewide ATOM Feed" />
参见 [编辑]
- 消息來源(饋送)
外部链接 [编辑]
- (英文)IETF Atom Publishing Format and Protocol working group (atompub)
- (英文)Atom Wiki
- (英文)AtomEnabled.org - Atom計劃的非官方支持網站
- (英文)The great syndication wars
- (英文)Why we need Echo
- (英文)Should Atom Use RDF?