Chapter Roadmap


This chapter discusses how you can use Perl to produce XML documents using a database as your data source. As you will see, one of the largest uses of XML is as a data storage facility. Because XML is based on a hierarchical data format, it's suitable to store almost any information, and it has the capability to mimic some of the capabilities found in relational database management systems (RDBMSs). However, because XML is stored in a text format, data cannot be retrieved as quickly or stored as efficiently compared to the binary formats used by modern RDBMSs. So, XML probably won't be replacing databases anytime in the near future, although a number of people are working very hard to develop XML-based databases. Currently, XML-based databases aren't mature enough to replace our existing RDBMSs.

XML is often used to transfer data between disparate systems. A large number of systems are in use today that exchange data, although they were never designed to do so. An example of such a system could be an e-commerce business. Many times, orders are collected by one company and shipped by another company. In this situation, the companies could use XML to exchange order information. XML can also be used if a company is migrating to a new relational database system. It may not be a big issue moving between versions of a database from the same vendor; usually the new version of the software will support an older version. If the new database is from a different vendor, and chances are they are incompatible, XML can provide a common format.

These examples may initially seem to be complex, and you might think they would be difficult to implement. Thanks to some of the Perl modules currently available, I'll show you that these conversions are easily accomplished.

In this chapter, we'll focus on the XML::Generator::DBI and XML::DBMS Perl modules. Both of these Perl modules play a fundamental role in XML and DBMS integration.

You'll need to install the following Perl modules to test the code examples in this chapter:

  • XML::Generator::DBI

  • XML::DBMS

  • DBI

  • DBD::CSV

  • DBD::MySQL

Note

If you have any questions about Perl modules (for example, where to get them, how to install them, and so forth), please refer to Appendix B, "Perl Essentials."


In addition to the modules, you're also going to be using a relational database. For the examples in this chapter, we're using MySQL, which is a very popular open source relational database server available for a number of platforms. Additional MySQL information and MySQL executables are available at http://www.mysql.com. Note that the XML::DBMS Perl module is not available on the normal CPAN web site; however, it can be found at http://www.rpbourret.com/xmldbms/.



XML and Perl
XML and Perl
ISBN: 0735712891
EAN: 2147483647
Year: 2002
Pages: 145

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net