Why not use XML to save Settings?
When I save settings from a device or a program it's typically in some inscrutable binary format. That's just dumb. Save in XML unless there is a strong reason not to. Just do it!
16-Dec-2005Version 2: 2023-03-18 10:09:41

I'm trying to update the settings on my NAT/Router but do so requires me to reenter all of the settings again by hand. While the device does allow me to save the settings but it uses some undocumented binary format.

XML isn't magic but it does provide a standard for saving information so as to allow me to try to understand the data and maybe even edit it myself.

The other problem with the binary format is that the devices often only allow the data to be reloaded with the same version of the firmware in the device. Since the XML information is self-describing it would easily be readable in other version of the device.

Of course there may be compatibility problems and data that I alter might cause problems but the device should always be cautious about accepting the data anyway. It's no different form a web page – many sites learn the hardware that they can't trust price data on the form they get – users would often change the prices themselves.

Using XML means that I could use my own tools. It would make it easy to support multiple devices and share techniques with others.

In theory one can do this with binary files but the documentation is rarely available. With XML by using names that correspond to the web-view you can do without documentation and allow users to guess. Simple and unnuanced but it allows one to get away with simply saving the data in XML and letting knowledgeable users discover it without promising support.

Microsoft recognized this by moving from DCOM (binary) to SOAP (XML). DCOM is fully documented it took a lot of work to figure out what was happening. SOAP allows users (or at least developers) to figure it out themselves. It allows for resilient interfaces by having a representation that is not closely tied to the accidental properties of any particular implementation. For example, you don't lose alignment by adding a new field.

One big advantage of XML in consumer electronics is that it allows us to escape the “standards” trap. When I read that the reason we don't have the “digital living” room is the lack of standards I get annoyed. Requiring standards before shipping products shows a failure to understand the lessons of the Internet and other rapidly evolving marketplaces. By using simple XML interfaces others can write tools to make the devices smarter and create tools to coordinate them. As standards emerge the open interfaces for the older devices make it feasible to write bridging software to keep them valuable.

Caveat – the bigger problem with the “Digital Living Room” is that the key players are for more interested in preventing the user from doing anything than making it easy – it's called Digital Rights Management but is really about companies choosing to cripple their products and minimize the value because their customers are presumed to be thieves. As a result you can't just connect two devices, you must make sure that every element of the system is just right otherwise nothing works. But that's another topic.

Even though I think it may over specify some aspects, I see UPnP as a step in this direction – too bad device manufacturers still don't understand the value in sharing product definition with their users – they miss out on being able to take advantage of millions of eager designers ready to improve their products.

I've already written about the advantages of using XML in a paper I presented in 1997 (The Internet and Consumer Electronics).

It's one thing to ask consumer electronics companies to add a new interface – especially when they don't even do networking. It's another to ask the manufacturers of devices that already have a web Interface to simply not be stupid – it's easier to support XML than arbitrary binary formats so why not just do it?