Java Reference
In-Depth Information
Handling Atom
Similar to RSS, to get started with Atom, you must initiate an instance of the AtomTask class.
The AtomTask class produces events for the Feed and Entry high-level nodes as they
are encountered during parsing. The next table describes Atom nodes and the events they
produced during parsing:
onChannel: function(:Feed):Void This function is invoked
after the Feed node of the
document is successfully
parsed. The method receives
an instance of Feed , which
contains data for all parsed
onItem: function(:Entry):Void
This function is invoked after
the Entry node and all of its
child nodes are successfully
parsed. The method receives
an instance of Entry , which
contains data for the parsed
Extension Nodes OnForeignEvent:
This function is called when
non-standard extension
nodes are encountered in
the document. The callback
function receives an instance
of the PullParser's Event
The instances of Feed and Entry passed into each callback function (respectively) gives
access to all of the additional nodes that make up a standard Atom document (that is: title,
link, author, contributor, description, generator, category, rights, and logo).
Override default parsing behavior
Another feature of the Feed API is the ability to override the way the internal parser handles
the documents. Both RssTask and the AtomTask classes use a Factory class to build
parsed nodes from the document. You can provide your own Factory class to override how the
nodes are parsed from the document. For instance, let's say we want to strip out any HTML
tags embedded in the title of your Atom document. The following steps show you how to do it.
Search WWH ::

Custom Search