Menu

XML You Can Touch

October 10, 2001

Edd Dumbill

I spend far too much time with XML. I may not have gone as far as one friend suggested, eating angle-bracket shaped food, but sometimes it feels like that. One of the hazards of over-indulging in a technology to that extent is that it may lose its newness. Familiarity can breed, if not contempt, then certainly a marked deficit in the surprise department.

This presents certain problems when attempting to address the topic of "what's exciting in XML today?" -- precisely the sort of question I am frequently called upon to answer. After three years of W3C-watching, the thrill, as they say, is gone, and waiting for the next spec to drop out of the machine has definitely lost its appeal. This is probably just as well, as I'm sure XML.com readers share this fatigue. Now that the basics of XML are in place, endless study of the infrastructure is of limited use.

So it's time to introduce a new way of ranking XML technologies. Being somewhat fed up of the dot-bomb and marketing ethos that newest is best, I prefer to maintain that tangible is best. What I mean by tangible could be helpfully illustrated by a story: my first job in the computer industry was working for a news agency. Unusually at the time for a software developer, I got a lot of satisfaction from the fact that hundreds of thousands of people would see the result of my work. I could show a newspaper to my family and say "I did that!"

An exciting use of XML for me now isn't just a spec, it's a use of XML that will actually result in something, well, useful. Maybe you can't show your family, but there might be a chance that more than a handful of people will value what you're up to. This leads me to talking about particular projects that make good use of XML. Although open source programs for direct manipulation of XML are often trumpeted, for instance, Xalan and Xerces, we've seen less attention paid to the deployment of XML within the more general field of open source software. There are in fact some interesting results to be found. Nobody has forced open source developers to use XML, and they're certainly not in it for the money or buzzword-compliance, so we can find there uses of XML where it stands on its own merits.

GNOME No Dwarf In XML Adoption

Aside from being immersed in XML, I've been a keen follower of the GNOME desktop project for a good while. Thanks in no small part to the efforts of Daniel Veillard, an ex-W3C hack now working at Red Hat, GNOME has adopted XML quite deeply. GNOME's core XML component, LibXML, provides the platform with an implementation of SAX, DOM, XSLT, and even OASIS catalogs.

Applications

The W3C's Scalable Vector Graphics technology (SVG) is without doubt the flavor of the month, and there are several tools for manipulating it within GNOME. Sodipodi, the creation of Estonian Lauris Kaplinski, is a drawing application that uses SVG as its native file format. A recent Linux.com interview with Kaplinski provided an insight into the good and bad points of using SVG:

The good thing about using a published standard is that I do not have to spend time creating an imaging model. I just have to implement it. No extra headache keeping file format upwards/downwards compatible. Using SVG natively may give Sodipodi [a] slight advantage in web development, as it will preserve 99.9% of hand-written structure.
The bad part is that SVG is created for display. Editing requires all kinds of fancy tweaks, that often need to keep serious meta-information in addition to SVG...Editing adds extra burden here, as we do not like unsupported features to be silently overwritten.

GNOME's diagramming tool, Dia, allows the creation of structured diagrams. It uses an XML vocabulary as its file format, and it supports export to SVG. One of the advantages of using an XML file format is that it provides an alternative to scripting. A more traditional Windows approach to automatically creating a diagram might be to access an application from VBScript, cause it to perform certain operations, and save a file. Open XML file formats simply reduce the required machinery to something like an XSLT sheet or a bunch of print statements, and give more flexibility than requiring the host application to be running. Of course there are issues with documenting the file format, but these are common to APIs, too.

The Nautilus file manager (screenshots) is another application that has taken XML to heart. GNOME's fancy-pants version of the Windows Explorer, Nautilus uses XML to store metadata about files and directories. It also allows SVG graphics to be used as icons. Evolution, GNOME's Outlook work-a-like, also uses XML extensively internally. As of yet it doesn't expose many external XML facilities, but it's a good example of XML used to its fullest potential for configuration and user interface design.

Developer tools

As one might expect with XML, there are some pretty clever applications under the hood in GNOME, in system and development tools. The star of the show is without doubt Glade, a user interface builder. Glade is a form designer that greatly speeds the development of GUI-based applications. Its native file-format again uses XML. Developers can either opt to generate code from the user interface, or, more excitingly, use the XML file directly within their programs.

Glade library routines are available to construct the user interface at runtime from the XML definition. Glade may sound familiar to followers of the Mozilla project, which has also defined a user interface language, XUL. There is some crossover between the two applications: although fraught with quirks, user interface definition is an area ripe for standardization. W3C's XForms goes some way to achieving this for browser-based UIs.

Configuration files are an obvious and well-established use for XML: as well as a ready-made syntax, XML also provides easy evolvability. The GNOME GConf component takes this a step further. GConf aims to be something like a next-generation version of the Windows Registry. The ultimate aim is to have pluggable storage backends for the data, but the first backend in use is an XML one.

Also in <taglines/>

XML 2004: After Declaring Victory, What's Next?

An Old New Thing

Moving On, But Not So Far

XML at Five

Whither Web Services?

GConf uses its own type of schema (written in XML, of course) to define the configuration data an application needs to store: ensuring at least a minimum level of documentation on which entries do what (something a Windows Registry hacker would be very grateful for). With the default backend, the application configuration data is also stored in XML. As a developer, I've found this an advantage over a less accessible binary storage, as it's easy just to view the data to ensure that the correct things are happening.

GNOME, like all modern desktop environments, is multilingual. This brings with it the headache of managing multiple translations. Thanks to the user interface being stored in Glade XML files, XML-based tools are able to automatically extract the labels from a user-interface definition and create the necessary catalog files for the GNU gettext internationalization system.

GNOME Is Not The Only Fruit

I've picked on GNOME because it's a system with which I am well acquainted, but many other open source endeavors are making use of XML in similar ways. Amid the excitement of e-business we can overlook conventional desktop applications. XML has been adopted on the desktop as the common sense option, particularly where document formats, configuration, and user interfaces are concerned. I believe ultimately we'll see the interoperability benefits of XML as much on the desktop as in networked communication.