XML in Databases
XML's usefulness multiplies with proper handling.
In a world of competing proprietary data formats, XML is a neutral and generalized format that is ideal for data exchange. It is especially suited for applications employing service-oriented architectures (SOAs), because to simplify reuse of program components, the individual services need to send and receive data in general formats.
XML data includes tags that can describe the data, including its formatting and uses. You can also use built-in security precautions with XML, including encryption and authentication features. Plus, the format is extensiblethe X in XMLso that you can define new formats for new data for new applications.
XML-format data presents both challenges and opportunities for databases. The challenges are obvious: A data item in XML format takes up more room in storage because you have to accommodate all those descriptive tags that come along for the ride. In addition, databases may need to perform extra processing to import and export in XML format.
The opportunities are more subtle and available only with databases that store XML in its native format, such as the Oracle XML Database. For example, because each data item has its own descriptive tag, versioning is possible, allowing you to examine successive changes to data. Those tags also make intricate searches through data possible.
The Business Problem
To illustrate when to use XML, consider a project I participated in with a large financial trading institution300 employees, 5,000 concurrent users, millions of transactions a day, and more than US$160 million in revenue. Before the market opens, incoming data includes premarket orders. During trading hours, real-time financial information flows into and out of the company. Then when the market closes, the end-of-day processing begins, including generating reports on the day's trading activity.
The problem? How to share information with a diverse audiencepartner companies and news mediathat used different applications and information. The company had been using flat-file information to provide service to customers and partners.
We elected to use XML to send data to the news media: XML's data tags provided the context necessary to define the enclosed information and served as useful input for automatic processing to news feeds. We also used XML to effect company-to-company data transfer. By contrast, we did not use XML for financial transactions because of concerns about both security and processing speed.
The challenge was to deliver the XML solution on time and within budget to provide that better information service. We managed to do that, and as a result, the company can now communicate with a broader audienceeven though each recipient has its own applications and formats. The company sends information out once in one format and no longer needs to scramble to match communications with customers and juggle multiple, ever-changing formats.
Another example of a corporate project I contributed to is the popular Web site of a company with 18,000 employees and more than US$4 billion in revenue. The site presents product information to potential customers. Manufacturers provide the site with detailed information on the products and their features. Local dealers supply information on which products, with which features, they have available to sell. Visitors to the site generate lots of queries, searching for specific products or features and comparing all the different products.
The site had originally used a proprietary data format that partners had to adhere to, which limited the site's growth and partnership opportunities. Switching to XML allowed the company to provide information consistently to a wide range of audiences and applications. The information flow between the local dealers and the Web site was entirely in XML format.
This setup made it simpler for the many dealersusing a variety of their own internal applicationsto provide their information and receive results and data from the site. As a result, it's now easier to scale up the site for the partners, who enjoy smoother growth and thus are better satisfied. The site data was all stored in the usual tables in an Oracle database. XML is not for every use or occasion. But when you need flexibility and neutrality, it can be ideal.
Ari Kaplan ( firstname.lastname@example.org ) is president of the Independent Oracle Users Group (IOUG) and senior consultant at Datalink. He founded Expand Beyond Corporation, a leader in mobile IT software. He has been involved in Oracle technology since 1992.