- XML Reference Guide
- Overview
- What Is XML?
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Table of Contents
- The Document Object Model
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- DOM and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Implementations
- DOM and JavaScript
- Using a Repeater
- Repeaters and XML
- Repeater Resources
- DOM and .NET
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Downloads
- DOM and C++
- DOM and C++ Resources
- DOM and Perl
- DOM and Perl Resources
- DOM and PHP
- DOM and PHP Resources
- DOM Level 3
- DOM Level 3 Core
- DOM Level 3 Load and Save
- DOM Level 3 XPath
- DOM Level 3 Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- The Simple API for XML (SAX)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SAX and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- SAX and .NET
- Informit Articles and Sample Chapters
- SAX and Perl
- SAX and Perl Resources
- SAX and PHP
- SAX and PHP Resources
- Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Document Type Definitions (DTDs)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Schemas
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- RELAX NG
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Schematron
- Official Documentation and Implementations
- Validation in Applications
- Informit Articles and Sample Chapters
- Books and e-Books
- XSL Transformations (XSLT)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XSLT in Java
- Java in XSLT Resources
- XSLT and RSS in .NET
- XSLT and RSS in .NET Resources
- XSL-FO
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XPath
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Base
- Informit Articles and Sample Chapters
- Official Documentation
- XHTML
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XHTML 2.0
- Documentation
- Cascading Style Sheets
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XUL
- XUL References
- XML Events
- XML Events Resources
- XML Data Binding
- Informit Articles and Sample Chapters
- Books and e-Books
- Specifications
- Implementations
- XML and Databases
- Informit Articles and Sample Chapters
- Books and e-Books
- Online Resources
- Official Documentation
- SQL Server and FOR XML
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- Service Oriented Architecture
- Web Services
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Creating a Perl Web Service Client
- SOAP::Lite
- Amazon Web Services
- Creating the Movable Type Plug-in
- Perl, Amazon, and Movable Type Resources
- Apache Axis2
- REST
- REST Resources
- SOAP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SOAP and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- WSDL
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- UDDI
- UDDI Resources
- XML-RPC
- XML-RPC in PHP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Ajax
- Asynchronous Javascript
- Client-side XSLT
- SAJAX and PHP
- Ajax Resources
- JSON
- Ruby on Rails
- Creating Objects
- Ruby Basics: Arrays and Other Sundry Bits
- Ruby Basics: Iterators and Persistence
- Starting on the Rails
- Rails and Databases
- Rails: Ajax and Partials
- Rails Resources
- Web Services Security
- Web Services Security Resources
- SAML
- Informit Articles and Sample Chapters
- Books and e-Books
- Specification and Implementation
- XML Digital Signatures
- XML Digital Signatures Resources
- XML Key Management Services
- Resources for XML Key Management Services
- Internationalization
- Resources
- Grid Computing
- Grid Resources
- Web Services Resource Framework
- Web Services Resource Framework Resources
- WS-Addressing
- WS-Addressing Resources
- WS-Notifications
- New Languages: XML in Use
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Google Web Toolkit
- GWT Basic Interactivity
- Google Sitemaps
- Google Sitemaps Resources
- Accessibility
- Web Accessibility
- XML Accessibility
- Accessibility Resources
- The Semantic Web
- Defining a New Ontology
- OWL: Web Ontology Language
- Semantic Web Resources
- Google Base
- Microformats
- StructuredBlogging
- Live Clipboard
- WML
- XHTML-MP
- WML Resources
- Google Web Services
- Google Web Services API
- Google Web Services Resources
- The Yahoo! Web Services Interface
- Yahoo! Web Services and PHP
- Yahoo! Web Services Resources
- eBay REST API
- WordML
- WordML Part 2: Lists
- WordML Part 3: Tables
- WordML Resources
- DocBook
- Articles
- Books and e-Books
- Official Documentation and Implementations
- XML Query
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XForms
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Resource Description Framework (RDF)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Topic Maps
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation, Implementations, and Other Resources
- Rich Site Summary (RSS)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Simple Sharing Extensions (SSE)
- Atom
- Podcasting
- Podcasting Resources
- Scalable Vector Graphics (SVG)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- OPML
- OPML Resources
- Summary
- Projects
- JavaScript TimeTracker: JSON and PHP
- The Javascript Timetracker
- Refactoring to Javascript Objects
- Creating the Yahoo! Widget
- Web Mashup
- Google Maps
- Indeed Mashup
- Mashup Part 3: Putting It All Together
- Additional Resources
- Frequently Asked Questions About XML
- What's XML, and why should I use it?
- What's a well-formed document?
- What's the difference between XML and HTML?
- What's the difference between HTML and XHTML?
- Can I use XML in a browser?
- Should I use elements or attributes for my document?
- What's a namespace?
- Where can I get an XML parser?
- What's the difference between a well-formed document and a valid document?
- What's a validating parser?
- Should I use DOM or SAX for my application?
- How can I stop a SAX parser before it has parsed the entire document?
- 2005 Predictions
- 2006 Predictions
- Nick's Book Picks
We've done a lot of talking about syndication here, but most of the time we're talking about RSS, the "grand old format" of syndication. Of course, it's not the only option out there. Amidst the wrangling over RSS formats in the last couple of years, a group of developers decided that it might be more expedient to simply start over, taking the best from existing formats and trying to avoid the worst.
And thus, Atom was born.
Atom, like RSS, is designed to provide information about content sources such as weblogs and other "serial" sources. Also like RSS, and Atom feed can be consumed by an application such as a feedreader, which then displays individual entries the user can read and/or click. For example, in this entry we can create an Atom feed for Chaos Magnet, and when we reference it from the homepage, Mozilla Firefox will recognize it and offer you the option to make it a live bookmark, extracting each individual link and making it into a bookmark.
Let's start with a definition of the actual feed:
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title type="text">Chaos Magnet</title> <subtitle type="html">The personal and professional <i>rantings</i> of Nicholas Chase</subtitle> <updated>2005-08-22T08:27:03Z</updated> <id>tag:nicholaschase.com,2005:1</id> <link rel="alternate" type="text/html" hreflang="en" href="http://www.chaosmagnet.com/"/> <link rel="self" type="application/atom+xml" href="http://www.chaosmagnet.com/blog/index.atom"/> <rights>Copyright (c) 2005, Nicholas Chase</rights> </feed>
Notice that we have a lot of the same type of information we would add for an RSS feed,
with some of the ambiguity removed. For example, notice the type
attributes on the
title
and subtitle
elements. Notice, however, that the italics tag
in the title has been escaped using entities. Another item to notice is the id
element.
This is an identifier that must be both unique and permanent. (If that scares you, don't worry.
Check the resources for great article from Mark Pilgrim on creating unique identifiers for Atom feeds.)
Atom also makes use of the link
element (although of course this time it's in the
Atom namespace and not the HTML namespace). The key here is the rel
attribute.
The alternate
link refers to an alternate presentation of the information described in the feed,
which is, of course, the blog itself, and the self
link is the URL for the feed document.
Atom also provides a great deal of descriptive power for individual entries. For example, we could start with a simple entry:
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title type="text">Chaos Magnet</title> <subtitle type="html">The personal and professional <i>rantings</i> of Nicholas Chase</subtitle> <updated>2005-08-22T08:27:03Z</updated> <id>tag:nicholaschase.com,2005:1</id> <link rel="alternate" type="text/html" hreflang="en" href="http://www.chaosmagnet.com/"/> <link rel="self" type="application/atom+xml" href="http://www.chaosmagnet.com/blog/index.atom"/> <rights>Copyright (c) 2005, Nicholas Chase</rights> <entry> <title>The Ambient Orb</title> <link rel="alternate" type="text/html" href="http://www.chaosmagnet.com/blog/archives/000677.html"/> <link rel="related" type="text/html" http://www.ambientdevices.com/cat/orb/orborder.html" /> <id>tag:chaosmagnet.com,2005:8.677</id> <updated>2005-08-18T11:56:46-05:00</updated> <published>2005-08-18T11:56:46-05:00</published> <author> <name>Nicholas Chase</name> <uri>http://www.nicholaschase.com/</uri> <email>spammagnet@nicholaschase.com</email> </author> <content type="xhtml" xml:lang="en" xml:base="http://www.chaosmagnet.com/"> <div xmlns="http://www.w3.org/1999/xhtml"> <p>Totally swamped so I don't have time to comment, but have a look at the Ambient Orb, a glowing sphere that ...</p> </div> </content> </entry> </feed>
Each entry in the feed consists of its own entry
element. The element has the basic information you'd expect,
such as title
, author information, and the actual content
(described by
language and specified as XHTML). Here again we have a unique and permanent id
,
and link
s.
In this case, we have two links, with the alternate
link once again referring to
the original data, i.e. the post to which this entry refers. The related
link represents
a URL discussed by the post. For example, in the original posting, I link to an order page for the
Ambient Orb, so I've pulled that out and added it to the related
link.
Of course, this is a fairly simple entry. A more complex entry may have more information about itself and about the information it references:
... <link rel="self" type="application/atom+xml" href="http://www.chaosmagnet.com/blog/index.atom"/> <rights>Copyright (c) 2005, Nicholas Chase</rights> <entry> <title>It's a Big Ad</title> <link rel="alternate" type="text/html" href="http://www.chaosmagnet.com/blog/archives/000680.html"/> <link rel="enclosure" type="audio/mpeg" length="1337" href="http://www.chaosmagnet.com/blog/podcasts/000680.mp3"/> <link rel="related" href="http://www.hugi.is/hahradi/bigboxes.php?box_id=51208&f_id=1395" /> <link rel="via" href="http://superdarlingengl.blogspot.com/2005_08_28_superdarlingengl_archive.html#112545422376893325" /> <id>tag:chaosmagnet.com,2005:8.680</id> <updated>2005-08-22T18:27:08-05:00</updated> <published>2005-08-22T18:27:08-05:00</published> <author> <name>Nicholas Chase</name> <uri>http://www.nicholaschase.com/</uri> <email>spammagnet@nicholaschase.com</email> </author> <contributor> <name>Sarah Chase</name> </contributor> <summary>Link to a humorous commercial.</summary> <content type="xhtml" xml:lang="en" xml:base="http://www.chaosmagnet.com/"> <div xmlns="http://www.w3.org/1999/xhtml"> <p>I love it when advertising doesn't take itself seriously. Check out this <i>very</i> big ad for Carlton draft.</p> </div> </content> </entry> <entry> ...
This entry has all of the same information the last one did, but also sports some additions.
For example, this entry has a related podcast, or audio file, so the enclosure
link
serves to point a tool such as iPodder or iTunes to it. The via
link is a way to
tip your hat to the place you first saw whatever cool thing you're pointing to. Atom also enables you to
credit other people who may have contributed to your success (or at least to your finishing a particular post),
and to provide extra information such as the author's personal homepage and/or e-mail address.
Atom was put together by developers who'd had a great deal of experience with syndication feeds,
so perhaps it's no surprise that it also includes a number of features that programmers tend to wish for
late at night when they're trying to finish an application. For example, you can leave
the content for an entry in another file, and simply reference that using the src
attribute for the content
element. You can even add a logo to your feed
by linking to an image with a 2:1 aspect ratio using the logo
element, and an icon
(suitable for viewing at the small size) 1:1 aspect ratio using the icon
element. Or you can move
entry's from one feed to another using the source
element.
Finally, I could reference this feed from my home page by adding a new link
:
... <meta name="keywords" content="XML, web, WWW, web services, technology, politics, bush, dean, xslt, xsl"> <meta name="blogchalk" content="United States, Florida, Tampa, English, Nicholas, Male, 31-35" /> <title>Chaos Magnet</title> <style type="text/css" media="screen">@import "layout3.css";</style></head> <link rel="alternate" type="application/atom+xml" title="RSS" href="http://www.chaosmagnet.com/blog/index.atom" /> <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.chaosmagnet.com/blog/index.rdf" /> <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.chaosmagnet.com/blog/rsd.xml" /> <script language="javascript" type="text/javascript"> function OpenComments (c) { ...
There's no telling how for Atom will actually go in the market. It's still around, which says something, but its fortunes seem to go up and down. It was once thought that Atom would destroy RSS, particularly when Google purchased Blogger, which provides feeds in this format. Now Microsoft is planning to incorporate RSS into Longhorn and the next version of Internet Explorer. Ultimately, it will probably stick around as an alternate format for a long time to come.