HTML and CSS Reference
In-Depth Information
function (error) {
rssReaderApp.alert("A download error occurred.");
}
);
The rssReaderApp.parseFeed function will receive whatever content the remote URL returns
and will attempt to transform it into a format usable by the application. It should be clear that if
something goes wrong with the download operation, then the control passes to the error function.
This means that if the rssReaderApp.parseFeed function gets invoked, it actually has some data to
work with.
The primary responsibility for the rssReaderApp.parseFeed function is to ensure that the data it
received is in a format it can handle. Because you are downloading RSS data, and because RSS is an
XML format, this is a good starting point for the parseFeed function.
rssReaderApp.parseFeed = function (response) {
if (response.responseXML == null) {
rssReaderApp.alert("Invalid data");
return;
}
// More action here ...
}
The response received from the server is encapsulated in the object passed to the function. If
received data can be rendered as an XML document object model, then the responseXML property
will not contain null , and control will pass to the code you will write next to query for the various RSS
elements.
An RSS feed follows the schema shown below:
<rss ...>
<channel ...>
<item>
<title> ... </title>
<link> ... </link>
<guid> ... </guid >
<description> ... </description >
<category> ... </category>
</item>
...
</channel>
</rss>
Search WWH ::




Custom Search