When you are traversing the document manually as shown, it is important
not to call the parse() method. This will cause the parser to move the
event cursor all the way to the end of the document.
For details on some of the topics presented here, refer to:
F Java IO Tutorial— http://java.sun.com/docs/books/tutorial/essential/
F XML Document Object Model— http://en.wikipedia.org/wiki/Document_
F Chapter 4—Creating a form with JavaFX controls
F Accessing remote data with HttpRequest
F Downloading images with HttpRequest
Using the Feed API to create RSS/Atom
We have seen in the previous recipes that JavaFX is well-suited to handle XML data. One of
the most pervasive usages of XML is the syndication of data made available through feed
formats, such as the RSS and Atom formats. In this recipe, we explore JavaFX's inherent
support for the RSS syndication format through the Feed API by building a simple weather
reader application using RSS data from Yahoo.
To understand this recipe, you should be familiar with the notion of web content syndication,
or web feeds. If not, have a quick look at http://en.wikipedia.org/wiki/Web_feed
which provides background information about how feeds are used. You should also take a
look at the previous recipe in this chapter, Building RESTful clients with the PullParser API .
In this recipe, we will show you how to parse RSS syndication feeds using JavaFX's RSS
Feed API located in the javafx.data.feed.rss package. For this recipe, you will pull
RSS-encoded weather data from Yahoo's weather services located at http://weather.
yahooapis.com/forecastrss . We will use JavaFX's RSS API to create an application
which displays weather conditions given a zip code. Unlike the other recipes presented
earlier, you will not need an API key for this example.