Once upon a time, in a land far, far away (IBM land) there was a handsome prince and a beautiful fairy princess.
OK, actually there weren’t any handsome princes. Just a bunch of guys with starched white shirts, skinny dark ties and blue suits. And even more depressing there weren’t any fairy princesses. June Cleaver and all the other would-be fairy princesses were home, adorned in pearls and dresses, waiting for the men to return from IBM land.
And what had those heroes been doing with their days in IBM land? One of the important struggles of those days was moving information from place to place; from one computer to another. But when one computer was radically different than another, it was really difficult.
For example, some computers of the day stored their integers with low order byte first and high order byte second. In those systems 01 02 meant 513 (1x1 + 2x256). Others did it the opposite way. In those systems 01 02 yielded 258 (1x256 + 2x1). To make matters more confusing, there were unique data types and different data formats.
How in the world do we move data from one of these systems to another, the men asked?
The answer in 1963 was to standardize the data by encoding all data in the seven bit codes called ASCII – the American Standard Code for Information Interchange. Then there was at least a common way of sending data that could be understood from one machine to another. 256 could be sent as 3 characters, a 2, a 5 and a 6. And that helped for a while.
As you can imagine that was insufficient. In 1996 a group chaired by Jon Bosak of Sun Microsystems proposed a new mechanism for transferring data; XML or eXtensible Markup Language.
XML became the language of choice for transferring data between two computers, be they a PC, a temperature controller, a programmable controller or an industrial drive. XML was revolutionary as it had the unique ability to transfer data and data descriptions in a format that is hardware independent, software independent, extensible and readable by any other system. Let’s look at a factory floor example to see some of the shortcomings the XML helped us overcome.
Imagine you have a weigh scale at the end of your production line. The weight delivered by this scale is important for your control system as it needs to reject under and overweight packages. It is important to your logistics systems as they need to load that package into a truck and it is important to your production control computer that needs to record how much is produced this hour, day, week and month. There are a lot of uses for this data.
As is typical for systems of this type, the weigh scale delivers a string of bytes in some format every time it completes a weighing operation. There might be a header and trailer that allow you to identify the start and end of the packet but you still have some questions. How exactly are the bytes formatted? Which bytes are the gross weight? Which are the Tare weight? And so on? Do these bytes have the actual weight or are they scaled? Are they in some kind of floating point format? Once you learn more about the data format you could program a system to receive those bytes but what happens if they add a byte somewhere?
If you expand this thought to the hundreds of factory floor devices each containing their own data encoded in their own special format, you get an idea of the problem XML is designed to solve. Using XML, a device transmits a text data file that not only contains the data but carries descriptions of the data as well.
Here is what an equivalent XML file might look like:
The XML data file is superior to the traditional data packet in a number of different ways:
1. The XML data file is completely hardware independent.
2. The XML data file is completely software independent. Any IT program, PLC program, basic program, or the like can read it, find the appropriate tags and extract the data.
3. An XML file is human readable and can be directly displayed by most current browser editions.
4. Data in XML files is extremely extensible. New data can be added at any time. As long as the current descriptors, known as “tags,” are not changed, the receiving software can continue to extract the data it needs no matter how much the rest of the data file has changed.
5. XML data is fixed format. All data is ASCII format and can be easily manipulated into the native binary format of the receiver.
The syntax of XML files is very straightforward and clear. The first line is a declaration describing the XML version number which validates the file. The next line is the root element. The root is the parent element for all the other elements in the file. You will notice that every element including the root has a start tag of the form “<tagname>” and an end tag of the form “</tagname>”. Data is contained between the start and end tags.
XML is not good for high speed, dedicated control applications. These applications require a small number of bytes delivered in real time. XML applications are applications where data needs to be delivered to widely different and disparate and sometimes, unknown destinations in a common, well-understood format.
And because of XML, the guys in the white shirts and would be fairy princesses lived happily ever after.