Prev | Current Page 346 | Next

David Berube

"Practical Reporting with Ruby and Rails"

The template gives you a builder object, and the builder object assumes
undefined methods represent tag names, so the xml.grades call creates a element.
The code then loops through all of the grades and creates a element for
each grade with the various properties set: student, id, and so forth. The initial calls to
xml.instruct! give various metadata about the document, including the XML version and
the location of the stylesheet.
nNote XML stylesheets affect the way the data looks when viewed in a browser. This approach is not as
flexible as using XSLT, but it??™s much more straightforward.
CHAPTER 12 n CREATING REPORTS WITH RUBY AND MICROSOFT OFFICE 250
Importing the XML Data into Microsoft Access
Now that you have a web application that serves up XML, you need a program to import
the data into Access. For this example, you??™ll use the DBI database library for Ruby, mentioned
earlier in the chapter. DBI comes with the Ruby one-click installer, but in order to
get DBI to work with ActiveX Data Objects (ADO), you??™ll need to install the ADO driver.


Pages:
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358