Internet‎ > ‎

Atom Publishing Protocol (APP) and Atom Syndication Format

Defined in :

  • RFC 5023 (Atom Publishing Protocol)
  • RFC 4287 (Atom Syndication Format)

What is it?

  • Atom Publishing Protocol : An application level protocol for publishing and editing web resources using HTTP [RFC 2616] and XML 1.0 [REC-xml].
  • Atom Syndication Format : Atom is an XML-based document format that describes lists of related information known as "feeds". Feeds are composed of a number of items, known as "entries", each with an extensible set of attached metadata. The Atom Syndication Format does not define any DTD/XSD for atom documents and thus does not require them to be hundred percent valid according to some DTD or XSD.

Important Concepts

  • Resource

A network-accessible data object or service identified by an IRI as defined in RFC 2616.
  • Service Document

A document that describes the location and capabilities of one or more collections and can group them into workspaces.

Need

For clients to author some content using APP they need to discover the capabilities and locations of the available collections. Service documents help in this process.

XML Elements Supported

1. app:service
    • Root element of service document.
    • Must contain one or more app:workspace elements.
2. app:workspace

  • Workspace

A named group of collections. APP specification does not define any specific processing needs for Workspaces.

XML Elements Supported

1. app:workspace
  • Contains zero or more app:collection elements.
2. atom:title
  • Each workspace must contain one atom:title element for giving humans a readable title.
3. app:collection

  • Collection

A collection is represented by an Atom Feed Document. It contains IRI and metadata about the member             resources. A feed is a collection only if its IRI is present in the Service Document. APP specification makes no distinction between the collection feeds and other kinds of feeds. Any feed can act both as a collection feed and some other public feed.

Entries in a collection must be ordered by there "app:edited" property. The most recently edited entries should come first in the document. The "app:edited" property cannot be used to determine th freshness of cached responses.

Atom Feed Document (Atom Syndication Format) can be understood to mean same thing as a collection although there are some confusing differences.

Features of Atom Feed Documents:

  • An Atom Feed Document is a representation of an Atom feed, including metadata about the feed, and some or all of the entries associated with it. 
  • Its root is the "atom:feed" element.

XML Elements Supported

1. app:collection
    • Must contain one app:title element.
    • May contain any number of app:categories element.
    • May contain any number of app:accept element.
2. atom:title
    • Inside app:collection it gives the human readable title for this collection.
3. app:categories
    • The server may reject creation and storing of members whose categories are not present in its categories list.
    • If a collection is open then valid members should not be rejected if they do not confirm to categories.
    • The absence of this element means that category handling for this collection is unspecified.
    • A "fixed" category list that does not contain any categories means that this collection does not accept category data.
4. app:accept
    • It specifies the type of media that can be posted.
    • Is similar to HTTP Accept request-header. 
    • "application/atom+xml;type=entry" is used for signifying that atom entries are accepted.
    • If no app:accept element exists then the client software should treat as equivalent to accepting atom entry resources by default.
    • If one app:accept element exists but is empty then it means that the collection does not accept atom entries. 

          XML Attributes Supported

1. href
    • Must contain one href attribute whose value gives the IRI of the collection.
  • Member Resource

A Resource whose IRI is listed in a collection is called a Member Resource.
  • Entry Resource

    • An Atom Entry Document represents exactly one Atom entry, outside of the context of an Atom feed.
    • Its root is the atom:entry element.

XML Elements Supported

1. atom:title
2. collection

  • Media Resource

A client can post media resources which may include among others images, audio and video. If the server accepts a media request then it must create two new resources:

1. Media Resource
2. Media Link Entry
    • Associated member entry of the media resource
    • Are represented as atom entries and appear in the collection
    • Contains the meta data about media resource
    • Contain IRI of the media resource

  • URI

A Uniform Resource Identifier as defined in RFC 3986 .
  • IRI

  • Category Document

          It contains lists of categories specified using the "atom:category" element from the Atom Syndication Format.

XML Elements Supported

    1. app:categories

  • REST Technique for editing resources

    • CREATING

      • POST is used to create a new, dynamically named resource. 
      • Server is free to alter the atom entry that has been POST while creating it. Therefore it should return a response body which must be an Atom Entry Document representing the newly created resource so that the client can correlate it.
      • On the creation of a Member Resource its member entry URI must be returned in a location header in the collections's response. 
      • If creation request was for an Atom Entry Document and the subsequent response from the server has a Content-Location header that matches the Location header 100 % then the client is authorized to interpret the response entity as being a complete representation of the created resource.
    • RETRIEVING

      • GET is used to retrieve a representation of a known resource.
      • Clients must not think that the Atom Entry returned in a Feed is full representation of the Atom Entry and should do a GET on the URI of the Atom Entry before editing it.
      • Collection Partial Lists : To conserve bandwidth the Server may respond to a GET request for a collection by giving a Feed Document containing a partial list of the collection's member resources and a link to the next partial list feed if it exists. Such a partial list must contain the most recently edited member resources.
The partial collection list must have an atom:link with a "rel" attribute value of "next" relation whose "href" value is the URI of the next partial list of the collection. The partial collection list may also contain "rel" attribute value of "previous", "first", "last".

You can visualize it to be something like Google's search page although Google is in HTML and here we are in XML and Atom Formats.
    • UPDATING

                    PUT is used for editing a resource.
    • DELETING

                    DELETE is used to remove a known resource.
  • Extensibility of Documents

Atom Publishing Protocol does not add any restriction on the addition of any elements outside the Atom Format. In case the processing software does not know how to process any element it leaves it's processing. It does not gives an error and makes no modification of the unknown element.
  • Caching

Clients are not assured to receive the most current representations of collection members using get if the server allows intermediaries to cache them.
  • MIME Types

    • application/atom+xml;type=feed
It identifies an Atom Feed Document.
    • application/atom+xml;type=entry
It identifies an Atom Entry Document.
  • If the type parameter is unspecified the type is ussumed to be unspecified requiring Atom processors to see the root element to determine the type of document.
  • application/atomsvc+xml
It identifies an Atom Publishing Protocol - Service Document.
  • application/atomcat+xml
It identifies an Atom Publishing Protocol - Category
  • Name Space Prefix

    • Atom Publishing Protocol : "app:"
    • Atom Syndication Format : "atom:" 
These 2 namespaces are not semantically significant but have been chosen arbitrarily.

  • Common Atom XML Attributes in Atom Syndication Format

    • xml:base
    • xml:lang
  • Common Atom XML Constructs in Atom Syndication Format

    • Text Constructs

      • The "type" attribute can have one of : "text", "html" or "xhtml".
    • Person Constructs

      • atom:name
        • It content conveys a human-readable name for the person.
        • The content of atom:name is Language-Sensitive.
        • Person constructs MUST contain exactly one "atom:name" element.
      • atom:uri
        • It conveys an IRI associated with the person.
        • Person constructs MAY contain an atom:uri element, but MUST NOT contain more than one.
      • atom:email
        • It conveys an e-mail address associated with the person.
        • Person constructs MAY contain an atom:email element, but MUST NOT contain more than one.
        • Its content MUST conform to the "addr-spec" production in [RFC2822].
    • Date Constructs

      • A Date construct is an element whose content MUST conform to the "date-time" production in [RFC3339].
      • In addition, an uppercase "T" character MUST be used to separate date and time, and an uppercase "Z" character MUST be present in the absence of a numeric time zone offset.
      • Examples
        • <updated>2003-12-13T18:30:02Z</updated>
        • <updated>2003-12-13T18:30:02.25Z</updated>
        • <updated>2003-12-13T18:30:02+01:00</updated>
        • <updated>2003-12-13T18:30:02.25+01:00</updated>
  • Atom Element Definitions

    • Container Elements

      1. atom:feed

      The "atom:feed" element is the document (i.e., top-level) element of an Atom Feed Document, acting as a container for metadata and data associated with the feed.

      XML Elements Supported

      1. atomAuthor [Min Occurrence : 0, Max Occurence : Any Number]

      2. atomCategory [Min Occurence : 0, Max Occurence : Any Number]

      3. atomContributor [Min Occurence : 0, Max Occurence : Any Number]

      4. atomGenerator [Min Occurence : 0, Max Occurence : 1]

      5. atomIcon [Min Occurence : 0, Max Occurence : 1]

      6. atomId [Min Occurence : 1, Max Occurence : 1]

      7. atomLink [Min Occurence : 0, Max Occurence : Any Number]

      8. atomLogo [Min Occurence : 0, Max Occurence : 1]

      9. atomRights [Min Occurence : 0, Max Occurence : 1]

      10. atomSubtitle [Min Occurence : 0, Max Occurence : 1]

      11. atomTitle [Min Occurence : 1, Max Occurence : 1]

      12. atomUpdated [Min Occurence : 1, Max Occurence : 1]

      13. atomEntry [Min Occurrence : 0, Max Occurrence : Any Number]


      2. atom:entry

      The "atom:entry" element represents an individual entry, acting as a container for metadata and data associated with the entry. This element can appear as a child of the atom:feed element, or it can appear as the document (i.e., top-level) element of a stand-alone Atom Entry Document.

      XML Elements Supported

      1. atomAuthor [Min Occurrence : 0, Max Occurence : Any Number]

      2. atomCategory [Min Occurrence : 0, Max Occurence : Any Number]

      3. atomContent [Min Occurence : 0, Max Occurence : 1]

      4. atomContributor [Min Occurrence : 0, Max Occurence : Any Number]

      5. atomId [Min Occurence : 1, Max Occurence : 1]

      6. atomLink [Min Occurrence : 0, Max Occurence : Any Number]

      7. atomPublished [Min Occurrence : 0, Max Occurence : Any Number]

      8. atomRights [Min Occurence : 0, Max Occurence : 1]

      9. atomSource [Min Occurence : 0, Max Occurence : 1]

      10. atomSummary [Min Occurence : 0, Max Occurence : 1]

      11. atomTitle [Min Occurence : 1, Max Occurence : 1]

      12. atomUpdated [Min Occurence : 1, Max Occurence : 1]


      3.atom:content

      The "atom:content" element either contains or links to the content of the entry.  The content of atom:content is Language-Sensitive.

       XML Attributes Supported

      1. type
      It may contain one of 4 things : "text" | "html" | "xhtml" | mime media type.
      The default value for this attribute is "text".

      2. src
      The value of src attribute value MUST be an IRI reference [RFC3987].  If the "src" attribute is present, atom:content MUST be empty. This attribute should only be present when the resource is present somewhere else and is not present inside the atom:content element. If this element is present then the type attribute discussed above should only contain the value of a mime media type. The processing software may choose to ignore the downloading of content from remote location or it may present it in a different manner.

      Processing Model

      1. If the value of "type" is "text", the content of atom:content MUST NOT contain child elements.

      2. If the value of "type" is "html", the content of atom:content MUST NOT contain child elements and SHOULD be suitable for handling as HTML [HTML].

      3. If the value of "type" is "xhtml", the content of atom:content MUST be a single XHTML div element [XHTML] and SHOULD be suitable for handling as XHTML.

      4.If the value of "type" is an XML media type [RFC3023] or ends with "+xml" or "/xml" (case insensitive), the content of atom:content MAY include child elements and SHOULD be suitable for handling as the indicated media type.

      5. If the value of "type" begins with "text/" (case insensitive), the content of atom:content MUST NOT contain child elements.

      6. For all other values of "type", the content of atom:content MUST be a valid Base64 encoding, as described in [RFC3548], section 3.
    • Meta Data Elements

1. atom:author

  • The "atom:author" element is a Person construct that indicates the author of the entry or feed.
  • If an atom:entry element does not contain atom:author elements, then the atom:author elements of the contained atom:source element are considered to apply.
  • In an Atom Feed Document, the atom:author elements of the containing atom:feed element are considered to apply to the entry if there are no atom:author elements in the locations described above.

2. atom:category

  • The "atom:category" element conveys information about a category associated with an entry or feed.

 XML Attributes Supported

1. term
The "term" attribute is a string that identifies the category to which the entry or feed belongs.
[Min Occurrence : 1, Max Occurrence : 1]

2. scheme
The "scheme" attribute is an IRI that identifies a categorization scheme.
[Min Occurrence : 0, Max Occurrence : 1]

3. label
The "label" attribute provides a human-readable label for display in end-user applications.  The content of the "label" attribute is Language-Sensitive. 
[Min Occurrence : 0, Max Occurrence : 1]

3. atom:contributor

  • The "atom:contributor" element is a Person construct that indicates a person or other entity who contributed to the entry or feed.

4. atom:generator

  • The "atom:generator" element's content identifies the agent used to generate a feed, for debugging and other purposes.
  • The content of this element, when present, MUST be a string that is a human-readable name for the generating agent.
  • The atom:generator element MAY have a "uri" attribute whose value MUST be an IRI reference [RFC3987].  When dereferenced, the resulting URI (mapped from an IRI, if necessary) SHOULD produce a representation that is relevant to that agent.
  • The atom:generator element MAY have a "version" attribute that indicates the version of the generating agent.

5. atom:icon

  • The "atom:icon" element's content is an IRI reference [RFC3987] that identifies an image that provides iconic visual identification for a feed.
  • The image SHOULD have an aspect ratio of one (horizontal) to one (vertical) and SHOULD be suitable for presentation at a small size.

6. atom:id

  • The "atom:id" element conveys a permanent, universally unique identifier for an entry or feed.
  • Its content MUST be an IRI, as defined by [RFC3987].
  • When an Atom Document is relocated, migrated, syndicated, republished, exported, or imported, the content of its atom:id element MUST NOT change.

7. atom:link

  • The "atom:link" element defines a reference from an entry or feed to a Web resource.
 XML Attributes Supported
    • href

      The "href" attribute contains the link's IRI.

      [Min Occurrence : 1, Max Occurrence : 1]

    • rel

      atom:link elements MAY have a "rel" attribute that indicates the link relation type.

      It may contain these possible values : 

      "alternate" | "related" | "self" | "enclosure" | "via"

      [Min Occurrence : 0, Max Occurrence : 1]

    • type

      On the link element, the "type" attribute's value is an advisory media type: it is a hint about the type of the representation that is expected to be returned when the value of the href attribute is dereferenced.

      [Min Occurrence : 0, Max Occurrence : 1]

    • hreflang

      The "hreflang" attribute's content describes the language of the resource pointed to by the href attribute. When used together with the rel="alternate", it implies a translated version of the entry.

      [Min Occurrence : 0, Max Occurrence : 1]

    • title

      The "title" attribute conveys human-readable information about the link.  The content of the "title" attribute is Language-Sensitive.

      [Min Occurrence : 0, Max Occurrence : 1]

    • length

      The "length" attribute indicates an advisory length of the linked content in octets; it is a hint about the content length of the representation returned when the IRI in the href attribute is mapped to a URI and dereferenced.

      [Min Occurrence : 0, Max Occurrence : 1]

8. atom:logo

  • The "atom:logo" element's content is an IRI reference [RFC3987] that identifies an image that provides visual identification for a feed. The image SHOULD have an aspect ratio of 2 (horizontal) to 1 (vertical).

9. atom:published

  • The "atom:published" element is a Date construct indicating an instant in time associated with an event early in the life cycle of the entry.
  • Generally this element will be associated with the initial creation or first availability of the resource.

10. atom:rights

  • The "atom:rights" element is a Text construct that conveys information about rights held in and over an entry or feed.
  • The atom:rights element SHOULD NOT be used to convey machine-readable licensing information.
  • If an atom:entry element does not contain an atom:rights element, then the atom:rights element of the containing atom:feed element, if present, is considered to apply to the entry.

11. atom:source

  • If an atom:entry is copied from one feed into another feed, then the source atom:feed's metadata (all child elements of atom:feed other than the atom:entry elements) MAY be preserved within the copied entry by adding an atom:source child element, if it is not already present in the entry, and including some or all of the source feed's Metadata elements as the atom:source element's children.
  • Such metadata SHOULD be preserved if the source atom:feed contains any of the child elements atom:author, atom:contributor, atom:rights, or atom:category and those child elements are not present in the source atom:entry.

12. atom:subtitle

  • The "atom:subtitle" element is a Text construct that conveys a human-readable description or subtitle for a feed.

13. atom:summary

  • The "atom:summary" element is a Text construct that conveys a short summary, abstract, or excerpt of an entry.
  • Do not keep it same as atom:title or atom:content.

14. atom:title

  • This element is a Text construct that conveys a human-readable title for an entry or feed.

15. atom:updated

      • The "atom:updated" element is a Date construct indicating the most recent instant in time when an entry or feed was modified in a way the publisher considers significant.
      • Therefore, not all modifications necessarily result in a changed atom:updated value.
      • Publishers MAY change the value of this element over time.
  • Encryption

    • The root of an Atom Document (i.e., atom:feed in an Atom Feed Document, atom:entry in an Atom Entry Document) MAY be encrypted, using the mechanisms described by XML Encryption Syntax and Processing [W3C.REC-xmlenc-core-20021210].
    • Section 5.1 of [W3C.REC-xmlenc-core-20021210] requires support of TripleDES, AES-128, and AES-256.  Atom Processors that decrypt Atom Documents MUST be able to decrypt with AES-128 in Cipher Block Chaining (CBC) mode.
    • Thus, Atom Processors that decrypt Atom Documents SHOULD check the integrity of the decrypted document by verifying the hash in the signature (if any) in the document, or by verifying a hash of the document within the document (if any).
  • Digital Signatures

    • The root of an Atom Document (i.e., atom:feed in an Atom Feed Document, atom:entry in an Atom Entry Document) or any atom:entry element MAY have an Enveloped Signature, as described by XML- Signature and Syntax Processing [W3C.REC-xmldsig-core-20020212].
    • Atom Processors MUST NOT reject an Atom Document containing such a signature because they are not capable of verifying it; they MUST continue processing and MAY inform the user of their failure to validate the signature.
    • In other words, the presence of an element with the namespace URI "http://www.w3.org/2000/09/xmldsig#" and a local name of "Signature" as a child of the document element MUST NOT cause an Atom Processor to fail merely because of its presence.
    • Section 4.4.2 of [W3C.REC-xmldsig-core-20020212] requires support for DSA signatures and recommends support for RSA signatures.  However, because of the much greater popularity in the market of RSA versus DSA, Atom Processors that verify signed Atom Documents MUST be able to verify RSA signatures, but do not need be able to verify DSA signatures.
    • When an Atom Document is to be both signed and encrypted, it is generally a good idea to first sign the document, then encrypt the signed document.  This provides integrity to the base document while encrypting all the information, including the identity of the entity that signed the document.
    • Benefit of Atom Publishing Protocol and Atom Syndication Format in implementing Content Management System

      • Any document can be encapsulated under 'Collection' in Atom Publishing Protocol and 'Feed' in Atom Syndication Format.
      • Different versions of a document can be saved in different 'Entries'. Therefore the most recent entry will contain the current version of the document. This does the version management for the document. This will help in content rollback also. It helps in developing conflict resolution tools also.
      • 'Service Documents'
      • Atom is XML based.
      • Atom XML elements can be embedded in existing XML documents since Atom does not have any fixed DTD or Schema.
      • Atom supports media files.
      • Atom is an open format.
      • Atom is widely understood format.
      • Atom is REST based.
      • Atom is simple to understand.
      • Atom is extensible. Therefore elements not inside atom can be added.
      • Atom supports concept of 'author'.
      • Atom supports concept of collaborator by 'contributor' element.
      • Atom helps in keeping track of the generating software by 'generator'.
      • Atom supports categorization of documents using 'category' element.
      • Atom helps to give unique ID to the document.
      • Atom help in conveying copyright information through 'rights' tag.
      • Atom helps in version management by providing 'summary' element.
      • Documents in atom can have human readable names in form of 'Title' element.
      • Atom also support last update details in form of 'updated' element.
      • Atom documents can be digitally signed and encrypted. Atom does not create any major problems in encryption and signing.
      • Atom helps in separating content from user interface. This helps in creation of powerful authoring tools since tools can reside on places other than content. The tools may be offline.
      • Since Atom supports media types it can act as asset repository also.
      • Atom provides rich Meta Data support.
      • Atom provides good caching support using E-Tags of HTTP Protocol.
      • Atom supports HTML content inside documents.
      • Atom is scalable. Atom does not impost any artificial limits of storage as well as content structure.
      • Since atom supports HTML content it can support custom CSS, custom JavaScript and services like Google Adsense, Google Analytics, Facebook client etc.
      • Since atom can support media types as well as HTML it can support Java applets, Flash content and separate CSS and JavaScript files.
      • Atom provides support for content filtering during uploading of data using 'accept' element.
      • Atom enables workflow control using the 'control' element and 'draft' element.

Comments