by Steven Pemberton

XForms is a language for describing interfaces to data, designed at W3C by researchers from industry and academia. It is a declarative language, meaning it describes what has to be done, but largely not how. The interface it describes does not have to run locally on the machine producing the data, but can be run remotely over the network. Since Internet of Things (IoT) computers typically have little memory and are low-powered, this makes XForms ideally suited for the task.

One of the unexpected successes of HTML was its adoption for controlling devices with embedded computers, such as home Wi-Fi routers. To make an adjustment to such a device, the user directs the browser to the IP address from which it is running and a small web server on the device serves up web pages that allow the user to fill in and submit values to change the working of the device.

However, the tiny embedded computers that form part of the IoT typically have memory in kilobytes, not megabytes, and lack the power to run a web server that can serve and interpret web pages. This calls for a different approach.

One approach is for the devices to serve up only the data of the parameters, so that those values can then be injected into an interface served from elsewhere. XForms [1], a standard that we have helped develop at W3C, is designed for exactly this type of scenario: although it is a technology originally designed for improving the handling of forms on the web, it has since been generalised to more general applications; version 2.0 is currently in preparation [2].

XForms has two essential parts: the first part is the model that specifies details of the data being collected, where it comes from, its structure, and constraints. It allows data from several sources to be combined, and data to be submitted to different places. It also ensures that as data is changed, that relationships between the data are kept up to date. The second part is the user interface that displays values and specifies controls for changing the values. These controls are specified in a device-independent manner that only describes what they are meant to achieve, not how to do it. This makes it easier to adapt the interface to different devices, screen sizes, etc., while still allowing the use of specific interfaces, such as radio buttons, via style sheets.
XForms has already been used for a number of years to control devices in this way at many petrol stations in the USA. Each device, storage tanks, petrol pumps, cash registers, and so on, contains a simple server that delivers its data as XML instances. XForms interfaces are then used to read and combine these values, and update control values (for instance the price of fuel being displayed on pumps).

As an example of how it could be used, Nest, a well-known producer of internet thermostats, has published the data-model interface to its devices. A simple interface to this could look like this:

<instance src=”http://thermostat.local/”/>
<bind ref="ambient_temperature_c"
type="decimal" readonly="true()"/>
<bind ref="target_temperature_c"
<bind ref="target_temperature_f"
type="decimal" calculate=
<submission resource=
method="put" replace="instance"/>

The following device-independent user interface control specifies that a single value is to be selected from the list of items, without specifying how that is to be achieved (using radio buttons, drop-downs or whatever):

<select1 ref="temperature_scale"
<item value="f" label="°F"/>
<item value="c" label="°C"/>

Experience with XForms has shown that using it can reduce production time and costs by a factor of ten. As an example, one very large pilot project reduced production time from five years with thirty people to a single year with ten people. These remarkable savings are due largely to the declarative nature of XForms, which greatly reduces the administrative programming needed. Several implementations of XForms are available, at least three of which are open-source. It is also part of the Open Document Format, implemented by Open Office and Libre Office. There is also a tutorial [3].

Nest API Reference:

[1] J. M Boyer (ed.), XForms 1.1, W3C, 2009,
[2] J. M. Boyer et al. (eds.), XForms 2.0, W3C, 2015,
[3] Steven Pemberton, XForms for HTML Authors, W3C, 2010,

Please contact:
Steven Pemberton
Chair of the W3C XForms WG, CWI, The Netherlands
E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.

Next issue: October 2024
Special theme:
Software Security
Call for the next issue

Image ERCIM News 101 epub
This issue in ePub format

Get the latest issue to your desktop
RSS Feed