The Safe Software Blog
Author:
Don Murray

Google
Get the Blog Newsletter

Delivered by FeedBurner

About Data    |   July 10, 2014   |   By Don Murray

7 Reasons to Love XML and its ‘Baby Brother’ JSON

XML Rant

Sometimes I get almost too excited about XML. Last month I was escorted out of our conference as I interrupted a session to proclaim my love of XML. Link to video of my rant.

XML technology is something that we have worked tirelessly on for over 10 years, and we have grown to love it.

Over that time our feelings towards it have changed from “Fear” (when we learned of yet another way that XML is being used to represent information) to “Adoration” (when we discover a new format that is based on XML).

Here is why I love XML and his little brother JSON. After reading this I am sure that you will love them too!

1. XML is an Open Standard

XML is an open standard maintained by the W3C (JSON is also an open standard ). This is important as it means that data is not locked into any proprietary format. It is thus available to be used by any application. This can be either directly if the application supports it, or via a tool like FME.

Unfortunately, much of the world’s data remains locked in proprietary systems. If you are in this situation and you lose access to those systems then you have also lost access to your data.

2. XML is Easy to Read

37 formats in FME are based on XML.

37 formats in FME are XML-based. Click to Expand.

Reading XML is easy, and many tools can do it. For FME, we use the open source Xerces-C++ open source library.

Some say that XML is “human-readable” and that is true in that you can open your favorite editor and inspect it. The ability to visually inspect and understand the “raw” data is a boon to anyone who wants to develop tools to work with those documents.

To be clear I am talking about the simple task of reading. XML often gets a bad rap as people may get frustrated that their tool can’t work with, or understand, the data model.  To everyone out there building XML data models I strongly encourage you to “Keep it Simple!”

Remember that much of the reason you are putting data into XML is to make it OPEN. If you build an overly complex/rich data model, then you are also making your data more difficult to consume, which is much of the point of putting it in XML in the first place.

Indeed there are several XML-based formats supported by FME that we are so complex that no other software package is currently able to work with them.  Of course, as the data is in XML anyone with enough motivation could work with the data.

3. XML is Easy to Validate

XML Validator transformer

The XML Validator is one of 400+ transformers in FME.

Again great open source tools and libraries are the solution here. A web search reveals many online XML validation tools. A good online tool that I have used is www.xmlvalidation.com.  Xerces is what we use within FME, and it enables us to do two types of validation:

  • Syntax Validation – The syntax of the XML is checked to ensure that it is well formed. You should make this a mandatory step whenever you are creating XML that has no schema. For JSON there is only syntax validation at this time although there are initiatives to add JSON schema.  Here is a link to a previous blog post I wrote on JSON validation.
  • Syntax and Schema Validation – If the XML is based on schema then you can validate both syntax and schema. Again you should always do this when you are creating XML, when possible.  Any complex XML document type generally has associated schema. The combination of document and schema is critical to creation of complex document types.

While things are getting better it still surprises me that how often we get invalid XML files. Please always ensure that the files that you are producing are valid. If you get a file that you are suspicious of, then use a tool such as the website above, or if you are an FME user then embed the validation at the start of your work flows. This could save you a bunch of time trying to work with an invalid file!

4. XML can Represent Any Kind of Data

XML: One format to rule them all!

XML, my precious.

When it comes to data, XML can be used to represent it all! One format to rule them all!

We have seen it used for many types of data from simple relational or tabular datasets, to complex data models such as AIXM which is designed to enable the management and distribution of Aeronautical Information Services (AIS) data.  We work with many other complex data models including, but not limited to, INSPIRE (Europe), and CityGML (Building and City Data) – here are links to FME webinars on CityGML and a couple on INSPIRE.

Again when defining new XML data models a friendly reminder to keep it as simple as possible.

5. XML / JSON is the Language of the Web

JSONThe world of web services and sensors is exploding. In this arena, communication is done almost exclusively with either XML or his little brother JSON. When building new web services today then I support JSON first and then XML.

I can’t think of a single web service that I can’t work with either of these formats. As a company that has spent a decade making industry leading XML and JSON technology this has made working with web services very simple.

6. XML Tools are Mature and Ready for Prime Time

A simple web search for “XML Tools and Libraries” reveals hundreds of tools and libraries. As our engine is in C++ we have made extensive use of Xerces. No matter what programming language you use you have many library to choose from. Pick your language for other reasons you may have and you can be sure that there will be good libraries for you to use.

7. XML Can Contain International Characters

Dale Lutz loves XML

Dale loves XML!

Even my good buddy Dale loves XML. He loves it because it has native support for international characters.

Long have we fought with international character sets at Safe, and with XML this is not a concern. It just works. Don’t believe me about Dale? Here is the proof!

How Real is XML?

When moving into new markets, or supporting new data sources, we almost immediately ask “Is this format XML-based?”

Why?

XML make it easier for FME support more formats in Japan.

XML make it easier for us support more Japanese formats.

At Safe the technology we have built is such that the effort to support a new XML / JSON data source is at least one order of magnitude easier than other formats. In most cases it just works. There is no effort.

This was evident when we recently discussed how to expand our support for formats in Japan. If the formats were XML then we knew that we could easily add them. If they weren’t, then the task for each format was much larger, if it was even possible at all.

Remember, even today there are still binary formats out there for which there is no spec. In other cases the spec is held tight by the vendor as a means of holding customers hostage.

Maybe someday all data will be in XML or JSON… (Silver bullet?)

The XML Challenge

I Love XMLLet me know how you feel about XML and JSON. If you have some data you are struggling with, then please send it to me at xml@safe.com

At Safe we believe that data should be free for you to use however, whenever, and wherever you want.

I am confident that we can help you with it. We look forward to the challenge of helping you.

At Safe we love XML and are sure you will too!