Professional XML Databases | 2
Professional XML Databases
The below articles are from Chapter 2 of the Wrox Press book Professional XML Databases. Professional XML Databases covers moving from a relational database to XML.
In this chapter, we will examine some approaches for taking an existing relational database and moving it to XML.
With much of our business data stored in relational databases, there are going to be a number of reasons why we might want to expose that data as XML:
- Sharing business data with other systems.
- Interoperability with incompatible systems.
- Exposing legacy data to applications that use XML.
- Business-to-business transactions.
- Object persistence using XML.
- Content syndication.
Relational databases are a mature technology, which, as they have evolved, have enabled users to model complex relationships between data that they need to store. In this chapter, we will see how to model some of the complex data structures that are stored in relational databases in XML documents.
To do this, we will be looking at some database structures, and then creating content models using XML DTDs. We will also show some sample content for the data in XML to illustrate this. In the process, we will come up with a set of guidelines that will prove helpful when creating XML models for relational data.
Note that there are some mechanisms out there already that provide a "default" way to derive XML from existing relational database structures. ADO 2.5 will return a "flattened" recordset in an XML representation, while SQL Server 2000 provides direct extraction of joined structures as XML. However, these technologies are still maturing, and can't handle more complex situations, like many-to-many relationships, that must be represented by IDREF-ID pointers. In this chapter, we'll see how structures can be handcrafted to properly represent these types of relationships. We will tune our structures to maximize performance, and minimize document size.
- Migrating a Database to XML
- Model the Tables
- Handling Foreign Keys
- Add Missing Elements to the Root Element
Created: April 30, 2001
Revised: April 30, 2001