Free White Papers
Ask the experts
Got a question? Put us to the test
XML - the Emperor's New Clothes?
Print | Email | Digg this story!
I was reminded of the fable by Hans Christian Anderson about the Emperor's New Clothes when in discussion with some architects (who I respect) about XML. They wanted to use XML within their enterprise and listening to them talking, it was not only going to solve all of their integration issues but it was going to solve world hunger as well!
"They gave out that they knew how to weave stuffs of the most beautiful colours and elaborate patterns, the clothes manufactured from which should have the wonderful property of remaining invisible to everyone who was unfit for the office he held, or who was extraordinarily simple in character"
So the Emperor commissioned them to make him some new clothes and of course no one wanted to appear unfit for their office or simple so when the Emperor tried on his new clothes they all said:
"How splendid his Majesty looks in his new clothes, and how well they fit! What a design! What colors! These are indeed royal robes!"
Now don't get me wrong, I like XML. I think it has been a major success story but it is only tagged data and the trouble is, in my opinion, people concentrate on the tags and forget about the data.
The Problem with XML Tags
Firstly, people start to create the most verbose tags that the world has ever seen; after all XML files should be human readable they tell you. I'm not sure where this rumour originated from, probably from the many XML standards organisations that have sprung up. However, computers process XML data files, not humans and they don't care what letters make up their labels.
Obviously it is important when starting an exchange with external partners that both parties understand the XML data file and the business context that should be attributed to the tags, but this is a design-time responsibility not a run-time issue.
Secondly, because of the verbose tags, the data payload increases dramatically in relation to the actual data that is being transmitted. I once read an article where the author tried to justify this by using the analogy of sending a valuable china ornament through the post. He argued that you would use as much padding as you thought necessary to ensure the ornament made it to the recipient in one piece.
This is, in my opinion, a bad analogy. Tagging does not protect the data in transmission, in fact it probably increases the chances of bad transmission because there are more bits to transmit and therefore more chance of errors creeping in.
Good Data Design Easier with XML
Thirdly, XML data file design often simply mimics the data file that it is replacing. The power of XML Schema to provide a more structured and coherent model of the data being exchanged is frequently ignored. Good information design can be more readily accommodated using XML Schema through the use of user-defined types, versioning and not repeating data elements for example.
Benefits of XML Schema Compliance
Many people ignore the power of XML Schema using it to merely specify the element as a string, integer or decimal. Others still ignore it altogether. The two most frequently cited reasons for this are:
- having to validate the data file against the Schema impacts performance and
- it inhibits the flexibility of what can be passed within the XML data file.
As a developer, the earlier I can be assured the data I am about to process is valid, syntactically and semantically correct the better from both a performance and cost perspective. Call me old fashioned, but I like things to work.
Back to the Emperor
So why the analogy with the Emperor's clothes? Just as with other software engineering disciplines good XML files do not just happen. Just because your file is XML doesn't make it fit to clothe an Emperor. To do that you need to understand the potentials and limitations of XML before you start getting creative!
There are many good resources available on the web that can provide valuable insights into good XML design; two of those which I use regularly are:
In conclusion, let's not throw out all our good design principles when we design XML files, but let's embrace them and ensure that what we dress the data in is really there and not a figment of our imagination.
Ask the Experts
The challenges your organisation faces are often more apparent than the possible solutions. At Oakleigh Consulting we are always happy to discuss options you can consider based on our substantial experience in change management and technology.
A simple phone conversation may be enough. Alternatively, we offer an initial meeting free and without obligation that many clients have found invaluable in identifying, prioritising and scoping their options.
If you have any questions about the subjects covered in this white paper or you would like to find out more about how Oakleigh Consulting could help your organisation, please contact us on 0161 835 4100 or email us.
Copyright
You may publish, quote or reproduce any white papers on this website on the condition that Oakleigh Consulting Ltd is notified, properly credited (and linked to) as the source, including our URL: www.oakleigh.co.uk.