Creating the Graphical XML Ticker
The ticker you??™ll create will scroll across the screen, displaying constantly updated data
on all of the stocks in your portfolio.
To run this example, you??™ll need a few gems installed: yahoofinance, fxruby, and
xml-simple gems. The YahooFinance module provides the quotes (you can refer to
http://transparentech.com/projects/yahoofinance and my Apress book, Practical Ruby
Gems, for more information about YahooFinance). FXRuby, introduced in Chapter 4, is an
interface to the cross-platform FOX GUI library. XmlSimple reads XML documents into
hashes. It??™s based on the Perl module of a similar name, XML::Simple. It is, as the name
implies, simpler than other methods of reading XML documents, so it??™s well suited for
reading the relatively simple array of symbols from the server.
nNote XmlSimple is a fantastic choice for simple documents, since it is easy to understand and use. For
more complex requirements, you can choose from a number of more sophisticated parsers, such as REXML,
which is included with Ruby, and Hpricot, which is demonstrated in Chapters 6 and 13.
Pages:
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262