IBM® Extensions to the Dojo Toolkit

Atom library, data store, and widgets

Atom library reference:

The Atom library is broadly split into three categories: utility functions, the Atom data model, and the AtomIO object.


Utility functions
Function Summary
String createDate(DOMNode node)
Creates a date from the node text content of a DOM
String escapeHtml(String str)
Escapes XML special characters in an HTML string
String unEscapeHtml(String str)
Un-escapes XML special characters in an HTML string
Date getIso8601Date(String iso8601String)
Converts an ISO-8610 date string into a date object
String dateToIso8601String(Date date, String offset)
Converts a date object to an ISO-8610 string
String getNodename(DOMNode node)
Gets a node name

Function Detail
createDate

escapeHtml

unEscapeHtml

getIso8601Date

dateToIso8601String

getNodename

Atom data model

For a reference for any of the Atom elements, take a look at the Atom specification, found here.

Component Overview
ibm_atom.io.atom.AtomItem Generic Atom element. Base class for Entry and Feed.
ibm_atom.io.atom.Category Atom category element
ibm_atom.io.atom.Content Atom content element. Handles multiple types (text, html, etc.) according to the Atom specification. Used for content, summaries, and titles.
ibm_atom.io.atom.Link Atom link element. Handles multiple link types (edit, alt, etc.)
ibm_atom.io.atom.Person Atom person element. Used to represent authors and contributors.
ibm_atom.io.atom.Generator Atom generator element
ibm_atom.io.atom.Entry Atom entry element. Represents an Atom entry, including storing the authors, contributors, title, content, and so on.
ibm_atom.io.atom.Feed Atom feed element. Represents an Atom Feed, including the feed elements such as the title and author, and also represents the entry list.
ibm_atom.io.atom.Service Atom service element
ibm_atom.io.atom.Workspace Atom workspace element
ibm_atom.io.atom.Collection Atom collection element

Component Details
ibm_atom.io.atom.AtomItem

Generally not used independently, the AtomItem class is the base class for Atom feed and entry objects, because they share some common components (title, subtitle, icon, arrays of authors, contributors, and links).

Object Variables
String ATOM_URI The URI of the Atom namespace
Array links Houses multiple ibm_atom.io.atom.Link objects of the links associated with this Atom item
Array authors Houses the ibm_atom.io.atom.Person objects of the authors
Array categories Houses the ibm_atom.io.atom.Category objects associated with this Atom item
Array contributors Houses the ibm_atom.io.atom.Person objects of the contributors
String icon The URL to the icon for this item
String id The ID of this item
String logo The URL to the logo for this item
String rights The associated rights for this Atom item
ibm_atom.io.atom.Content title The title of this item
ibm_atom.io.atom.Content subtitle The subtitle of this item
Date updated The date that this item was updated
ibm_atom.io.atom.Content content The content of this item
Array entries Array of ibm_atom.io.atom.Entry objects for this item

Object Functions
Boolean accept(String tag)
Returns whether this item accepts the given tag name. Overriden by child classes
void _postBuild()
Function ran after buildFromDom completes. Child objects can override this function if needed to add functionality after building is complete.
void buildFromDom(DOMNode node)
Builds this AtomItem from a given DOMNode.
void addAuthor(String name, String email, String uri)
Adds an author to this item with the given information
void addContributor(String name, String email, String uri)
Adds a contributor to this item with the given information
void addCategory(String name, String term, String label)
Adds a category to this item with the given information
void addLink(String href, String rel, String hrefLang, String title, String type)
Adds a link with the given attributes to this item
Number removeLink(String href, String rel)
Removes the given link from this item, returning the number of links removed
Number removeBasicLinks()
Removes all basic links (links with no rel attribute) from this item, returning the number of links removed
Array getCategories(String scheme)
Gets all categories matching the given scheme for this item and returns them in an array
Number removeCategories(String scheme, String term)
Removes all categories matching the given scheme, returning the number of categories removed.
void setTitle(String str, String type)
Sets the title of this item to the given str with the given type.
void addExtension(String name_space, String name, Array attributes, String content, String shortNS)
Adds in an extension namespace into the item.
Array getExtensions(String name_space, String name)
Gets all extensions matching the given name_space and name and returns those extension in an array. name_space can be the full namespace (like 'http://www.w3.org/2005/Atom') or the given short name (like 'atom')
void removeExtensions(String name_space, String name)
Removes all extensions matching the given name_space and name
void destroy()
Deletes all variables associated with this item
ibm_atom.io.atom.Category

This object represents the Category element of the Atom specification. Entries and feeds can each have category elements to convey information about the entry or feed.

Object Variables
String scheme The scheme for this category
String term The term for this category
String label The label for this category

Object Functions
Boolean accept(String tag)
Always returns false, as categories have no child elements.
void _postBuild()
Function ran after buildFromDom completes. Child objects can override this function if needed to add functionality after building is complete.
String toString()
Returns a string representing this category as XML
void buildFromDom(DOMNode node)
Creates this category from the given XML node
ibm_atom.io.atom.Content

This object models a generic content object, which is used in the Atom specification as titles, subtitles, content, and summary. A content object can have various types in addition to its value.

Object Variables
String tagName The name of this element, such as content, summary, and so on
String value The value of this element
String src The URL that contains the value of this element
String type The type of content stored in this element. Acceptable values are listed below.
String xmlLang The language of the content. This language is included in the output if this element is put to a string.
String HTML A string representing the HTML type
String TEXT A string representing the text type
String XHTML A string representing the XHTML type
String XML A string representing the XML type

Object Functions
void _postBuild()
Function ran after buildFromDom completes. Child objects can override this function if needed to add functionality after building is complete.
void buildFromDom(DOMNode node)
Builds this content object from a given DOMNode.
String toString()
Returns a string representing this category as XML.
ibm_atom.io.atom.Link

This object represents the Atom link element.

Object Variables
String href The URL for this link
String hrefLang The hrefLang attribute
String rel The rel attribute, describing the relation of this link to the parent item
String title The title of this link
String type The type of link

Object Functions
void _postBuild()
Function ran after buildFromDom completes. Child objects can override this function if needed to add functionality after building is complete.
void buildFromDom(DOMNode node)
Builds this link object from a given DOMNode
String toString()
Returns a string representing this category as XML
ibm_atom.io.atom.Person

This object represents a person object, which is used for the author and contributor types in the Atom specification. A person object can have a name, an email address, a URI, or both.

Object Variables
String personType The type of person this object represents, typically either author or contributor.
String name The name of this person object
String email This email address of this person
String uri This URI of this person

Object Functions
void _postBuild()
Function ran after buildFromDom completes. Child objects can override this function if needed to add functionality after building is complete.
void buildFromDom(DOMNode node)
Builds this person object from a given DOMNode
String toString()
Returns a string representing this category as XML
Boolean accept(String tag)
Returns whether this item accepts the given tag name; overriden by child classes
ibm_atom.io.atom.Generator

This Atom element conveys information about the package that generated this Atom feed. A generator can have a URI and a version number, in addition to the human-readable name.

Object Variables
String uri The URI for this generator
String version The version number of this generator
String value The human-readable name of this generator

Object Functions
void _postBuild()
Function ran after buildFromDom completes. Child objects can override this function if needed to add functionality after building is complete.
void buildFromDom(DOMNode node)
Builds this generator object from a given DOMNode.
String toString()
Returns a string representing this category as XML.
ibm_atom.io.atom.Entry

Representing the Atom entry element, this object extends ibm_atom.io.atom.AtomItem. The appropriate inherited variables and functions can be found here.

Object Variables
String feedUrl The URL of the Atom feed that owns this entry

Object Functions
String toString()
Returns a string representing this Category as XML
Boolean accept(String tag)
Returns whether this item accepts the given tag name; overriden by child classes
String getEditHref()
Discovers the URL to send updated entry information to by way of the Atom Publishing Protocol
ibm_atom.io.atom.Feed

Representing the Atom feed element, this object extends ibm_atom.io.atom.AtomItem. The appropriate inherited variables and functions can be found here.

Object Functions
String toString()
Returns a string representing this category as XML
Boolean accept(String tag)
Returns whether this item accepts the given tag name; overriden by child classes
void addNamespace(String fullName, String shortName)
Adds the given namespace to this feed
void addEntry(ibm_atom.io.atom.Entry Entry)
Adds the given entry into this object representation of the Atom feed. This function does not send any data to the server.
ibm_atom.io.atom.Entry getFirstEntry()
Retrieves the first entry of this Atom feed
ibm_atom.io.atom.Entry getEntry(String entryId)
Retrieves the entry identified by the given ID string
Number removeEntry(ibm_atom.io.atom.Entry entry)
Removes the given entry from the feed, returning the number of entries removed
void setEntries(Array arrayOfEntry)
Adds the entries contained in the given array into this Atom feed
ibm_atom.io.atom.Entry createEntry()
Creates a new empty entry object, sets its feedUrl variable, and returns the entry object
String getSelfHref()
Gets the URL of this Atom feed, or returns a null value if the feed does not include the appropriate link object
ibm_atom.io.atom.Service

An Atom service document describes the services that a server implementing the Atom Publishing Protocol offers. This object represents this type of document.

Object Variables
String href The URL to the service document

Object Functions
void buildFromDom(DOMNode node)
Builds this service document from a given DOMNode
Array getCollection(String url)
Retrieves an array of all collections identified by the given URL
ibm_atom.io.atom.Workspace

An Atom workspace element is a part of an Atom Service document, as defined by the Atom Publishing Protocol specification, and is for organization in the service document.

Object Variables
String title The title of this workspace
Array collections The collections housed by this workspace

Object Functions
void buildFromDom(DOMNode node)
Builds this workspace object from a given DOMNode
ibm_atom.io.atom.Collection

An Atom collection describes a set of resources, accessible from a given URL that are identified by a title.

Object Variables
String href The URL for this collection
String title The title of this collection
Array attributes The attributes of this collection
Array features The features of this collection
Array children The children of this collection; for example <accept> or <category> elements
String memberType The member type of this collection
String id The ID string of this collection

Object Functions
void buildFromDom(DOMNode node)
Builds this Collection object from a given DOMNode

AtomIO object

The AtomIO object is meant to provide an easy interface for developers to quickly get started interfacing with an Atom feed or Atom Publishing Protocol (APP) server implementation. This object does not maintain a Feed object or any internal variables between calls. If a developer is trying to keep a local representation of a feed (see feed above) synchronized with the server copy, then it is their responsibility.

Object Variables
Boolean sync Whether requests from this AtomIO object are forced to be synchronously
Boolean useCache Whether to turn off caching (in the XHR requests)
Boolean alertsEnabled Whether to display alert boxes on IO errors or to just die silently

Object Functions
void getFeed(String url, Function callback, Function errorCallback, Object scope)
Retrieves a specific Atom feed from the given URL
void getService(String url, Function callback, Function errorCallback, Object scope)
Retrieves a service or introspection document from the given URL
void getEntry(String url, Function callback, Function errorCallback, Object scope)
Retrieves a specific Atom entry document from the given URL
void updateEntry(ibm_atom.io.atom.Entry entry, Function callback, Function errorCallback, Boolean retrieveUpdated, Boolean xmethod, Object scope)
Updates the remote entry using the given entry, tailoring the request based on the given parameters
void addEntry(ibm_atom.io.atom.Entry entry, String url, Function callback, Function errorCallback, Boolean retrieveUpdated, Object scope)
Adds a new entry to the given collection URL, based on the given parameters
void deleteEntry(ibm_atom.io.atom.Entry entry, Function callback, Function errorCallback, Boolean xmethod, Object scope)
Deletes the specified Atom entry from its collection

Function Detail
getFeed

getService

getEntry

updateEntry

addEntry

deleteEntry