Home > Articles > Web Services > XML

  • Print
  • + Share This
Like this article? We recommend


The XML representation might be a good approach when you have to store rarely used properties of the objects you're representing in your relational database.

You should use the XML representation only if the following are true:

  • The data is sparse (your objects have many properties, but only a small percentage of all objects have the same property).
  • You don't know the data structure in advance (for example, the Amazon product catalog has expanded significantly from the times it was a simple online bookstore).
  • You want to share data with other applications in XML format.

However, if any of the following is true, you should store object properties as individual columns in the relational database:

  • You're performing frequent queries on property values or existence of the property (for example, find all blue products).
  • You have to enforce the referential integrity of a property.

Your choice might also be influenced by the database engine you're using. If your database engine has limited or no XML support, you should be more biased toward the traditional relational model (because it's expensive to perform LIKE queries on XML markup).

  • + Share This
  • 🔖 Save To Your Account