8.1. XML Programming Overview

More and more, people are using XML to store their data. Software applications can use XML to store preferences and virtually any kind of information from chemistry formulae to file archive directories. Developers should seriously consider the benefits of using XML, but there are also limitations to be aware of.

XML is not the perfect solution for every data storage problem. The first drawback is that compared to other solutions, the time required to access information in a document can be high. Relational databases have been optimized with indexes and hash tables to be incredibly fast. XML has no such optimization for fast access. So for applications that require frequent and speedy lookups for information, a relational database is a better choice than XML.

Another problem is that XML takes up a lot of space compared to some formats. It has no built-in compression scheme. This means that although there's no reason you can't compress an XML document, you won't be able to use any XML tools with a compressed document. If you have large amounts of information and limited space (or bandwidth for data transfers), XML might not be the best choice.

Finally, some kinds of data just don't need the framework of XML. XML is best used with textual data. It can handle other datatypes through notations and NDATA entities, but these are not well standardized or necessarily efficient. For example, a raster image is usually stored as a long string of binary digits. ...

Get Learning XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.