By Noah | May 17, 2009
Many readers of this blog know that I was one of the original designers and editors of the W3C XML Schema Language Recommendation (XSD). Since publication of version 1.0 in May 2001, a small group of us has continued to work on incremental improvements. I am therefore delighted to announce that, a few days ago, XML Schema Version 1.1 became a W3C Candidate Recommendation. This means that the specification is feature-complete, and the W3C is waiting for two or more interoperable implementations to demonstrate that the technology is suitable for designation as a full W3C Recommendation.
Why should you care? XSD 1.1 adds a relatively small list of specific features to the language, but I’m convinced that it addresses some of the most important opportunities that were missed in the original XSD 1.0. Specifically:
- The great promise of languages like XML is that their explicit markup can facilitate communication between systems that don’t completely agree on the legal content of messages. If you’re using XML to communicate among lots of organizations, then not all of the software will be updated on the same day when new features are added to the protocol. Because XML uses explicit tagging, it should be possible for the programs involved to discover which parts of the message were fully understood, and which were not, and to make reasonable decisions on how to proceed. XSD 1.0 did not make it particularly easy to write and deploy schemas to be used in such “loosely coupled” scenarios; XSD 1.1 adds some simple features that directly address this need. I hope to write a more detailed blog posting on this sometime, but in the meantime, take a look at the guide published as a working draft by David Orchard.
- XSD 1.0 had some very useful facilities for making sure that the structure and the content of your XML documents is what you want it to be. Unfortunately, even some simple and important constraints were impossible to express. For example, you could easily say that attributes named “max” and “min” were both required on some element, but you couldn’t easily require that max>=min. In XSD 1.1, that’s easy to do, using the new <xsd:assert> element. By the way, <xsd:assert> was directly inspired by Rick Jelliffe’s Schematron, but <xsd:assert> is not intended to replace all uses of Schematron. If you’re trying to capture business rules that affect widely scattered parts of your document, Schematron is still a good way to do it. If you’ve been tempted to use Schematron to capture localized constraints on the content or structure of your Schema types, then the new <xsd:assert> facility gives you a clean facility that’s completely integrated with XSD’s type system.
XSD 1.1 also has numerous other improvements, including for Schema datatypes. The whole datatypes document has been rewritten to be clearer, and less ambiguous, and the restructured table of comments makes it easier to find information on particular types. There is also a new precisionDecimal type that is designed to provide XML support for the new IEEE 754-2008 floating point decimal standard. (My good friend Mike Cowlishaw did a lot of the work behind the new IEEE standard. His paper Decimal Floating Point: Algorism for Computers sounds painfully dry from the title, but is beautifully written, has lots of interesting history about numerical computation, and is highly recommended.)
Sandy Gao, who is IBM’s lead representative to the Schema Working group, has partnered with some other IBMers to write a multipart introduction to XSD 1.1. Part 1 and Part 2 are available now on IBM’s developerWorks. Four additional articles are promised.
If this all sounds interesting to you, do subscribe to and ask questions on the firstname.lastname@example.org mailing list (archives). Many of the XSD working group members and other schema experts hang out there. More to the point: if you want this new function for your XML system, be sure to talk to whoever sells you (or gives you) XML software. Just because W3C comes out with a new specification does not mean it will be widely implemented soon. Software vendors have lots of good things to do besides revising their XML support. The next step in getting XSD 1.1 into everyone’s hands is to convince the authors of XML software that XSD 1.1 support is important to you, their customers and users. I hope that, after you look at it, you’ll agree that it is. There are also some great opportunities for new schema-related tooling that can exploit features of XSD 1.1. If you want some ideas, let me know and I’ll post some.
By the way: I am not an editor of the new 1.1 revision of XSD. The XML community owes a tremendous debt to editors Michael Sperberg-McQueen, Sandy Gao, Dave Peterson, Henry Thompson and Ashok Malhotra. David Ezell of Verifone has chaired this difficult effort with exceptional patience and wisdom, and some others like Mary Holstege and Michael Kay have made years of important contributions without even the reward of having their names at the top of the specifiction. Creating a brand new language like XSD can be a good way to build a reputation; editing even a very important revision seldom is. These folks have contributed a really heroic effort over many years, often under very difficult circumstances, and with relatively little recognition. Thank you all!