Java Reference
In-Depth Information
There's more...
The Feed API is used to process both RSS and Atom feeds. The API uses an asynchronous
task-based approach to process incoming web feeds. For both types of documents, the API
produces events that are mapped to high-level nodes found in these document types (that
is, Channel in RSS or Entry in Atom). Let's look at how they parse that information.
Handling RSS
To get started with processing RSS data, you need to initiate an instance of the RssTask .
As the internal parser processes the document, the RssTask object produces events for all
high-level nodes as they are encountered during parsing. The following table shows the RSS
document nodes and their associated events produced during parsing:
Node
Event-Handler
Description
Channel
onChannel:
function(:Channel):Void
RssTask calls this function
after the RSS Channel node
is successfully parsed. The
callback function receives an
instance of Channel , which
contains all parsed nodes
under Channel.
Item
onItem: function(:Item):Void
This function is invoked when
the Item node on the RSS
document is fully realized.
The callback function receives
an instance of Item , which
contains all parsed nodes
under Item.
Extension
Nodes
onForeignEvent:function(:javafx.
data.pull.Event)
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 class.
The instances of Channel and Item passed into each callback function (respectively) gives
access to all of the additional nodes that make up a standard RSS document (that is: title,
link, description, generator, category, pubDate, guid, and image).
Search WWH ::




Custom Search