Skip to main content

XML is Not a Database

XML is good- but only for some things. XML is very good at describing ordered lists, documents like they will be printed on paper, and simple trees, like family trees. For other things, XML is really bad. All other computer data with a more abstract nature has trouble conforming efficiently to the tree hierarchy of XML. Programs which use XML to describe and retrieve all kinds of data indiscriminately, suffer intense processing delays- particularly while attempting to traverse an ordered list to retrieve unordered data.

The strongest feature of XML is that it's very close to the ubiquitous HTML. It's easy for many people to learn about XML because they're used to HTML. Data described by XML can be transformed into HTML very easily.

XML works great to describe lists of items, like feeds of syndicated content for things like a news feed, stock quotes, or a series of audio or video episodes. It's great at describing outlines, with bigger sections broken down into smaller and smaller sections. It describes forms of data entry like control panels (buttons, sliders, and switches,) and parts of forms (like text entries, check boxes, and selections from a list of multiple choices.) Really it's pretty good for describing visual documents for direct human consumption, as they'll be printed on paper or displayed statically on a flat screen.

But it's for "documents," not for "data!" This is important because the data in XML documents will always be in a specific order. If it's about books, the books will either be listed by title, or by author. If you want to look up a book in the document, by title, when they're listed by author, you'll have to traverse all the authors looking at every title- unless you create some additional artificial layer cross-indexing the document. Easy you say- make two lists in the file that work both ways. But when you have a million books and also need the ability to search by ISBN, publisher, and copyright date, how efficient will that be? :-)

Don't panic. There's a solution which has been invented. Actually, this invention took place many years ago, and has been proved solid to many people through intensive usage. Have you ever heard of the Relational Database? Unlike the XML document, the Relational Database has been specifically designed to store and retrieve every type of data, for every usage imaginable. And it's super efficient, too. I hope you know SQL.

Comments

Popular posts from this blog

Reality Checks to Demystify Buzzwords

As an IT insider, I feel I have something valuable to offer nontechnical people in terms of correcting misinformation. Here are a few simple tests for some popular buzzwords in tech. When evaluating a product or service, if you can honestly answer Yes to the reality check question, the buzzword probably truly applies. If the answer is No, it is probably fake. agile Does it make the developers happy? blockchain Does it cut out the middleman? cloud Does it automatically scale? microservice Does it only do one thing? object oriented Is it mostly made of interfaces? RESTful When requests arrive at a certain address, are they ready to use (without parsing)? unit test Does it prevent the tested code from touching anything outside itself?

The Importance of Direction

Which would you say is more important: getting somewhere faster, pushing something harder, or going the right direction? It should be obvious that no matter how much speed or power you use, that won't do any good if you're going the wrong direction. It could also be pointed out that early in a journey, even a small change in direction makes a big difference in where you end up. Therefore, we should make sure we have our direction correct, as the first priority.

How (Not) to Handle Different Exceptions

Came across this sample from a certain multi-billion-dollar company, purporting to show how to implement exception handling. I slightly changed a few cosmetic details to make it anonymous. try { // ... } catch (GeneralException e) { if (e instanceof SpecificExceptionA){ // ... } else if (e instanceof SpecificExceptionB){ // ... } } This is a true actual story--you can't make this stuff up. Yeah, I thought it was pretty hilarious; so I felt like I had to share it.