Elliotte Rusty Harold’s RELAX Wins may be a milestone in the life of XML. Everybody who actually touches the technology has known the truth for years, and it’s time to stop sweeping it under the rug. W3C XML Schemas (XSD) suck. They are hard to read, hard to write, hard to understand, have interoperability problems, and are unable to describe lots of things you want to do all the time in XML. Schemas based on Relax NG, also known as ISO Standard 19757, are easy to write, easy to read, are backed by a rigorous formalism for interoperability, and can describe immensely more different XML constructs. To Elliotte’s list of important XML applications that are RELAX-based, I’d add the Atom Syndication Format and, pretty soon now, the Atom Publishing Protocol. It’s a pity; when XSD came out people thought that since it came from the W3C, same as XML, it must be the way to go, and it got baked into a bunch of other technology before anyone really had a chance to think it over. So now lots of people say “Well, yeah, it sucks, but we’re stuck with it.” Wrong! The time has come to declare it a worthy but failed experiment, tear down the shaky towers with XSD in their foundation, and start using RELAX for all significant XML work. [Update: Piling-on are Don Park, Gabe Wachob, Mike Hostetler and some commenters. There’s thoughtful input from Dare Obasanjo, and now the comments have some push-back too. And oh my goodness gracious, a Rick Jelliffe must-read.]


Comment feed for ongoing:Comments feed

From: Noah Slater (Nov 27 2006, at 17:49)

Agreed. I feel the Overton window shifting some more...



From: Robert Sayre (Nov 27 2006, at 19:20)


Sticking with XSD is evidence of ignorance, irrational decision making, and poor management.


From: John Cowan (Nov 27 2006, at 19:56)

I wish. Unfortunately, I think that the various 800-lb gorillas of Web Services will never adopt RNG: they are too deeply invested in WXS and all that goes with it, with W3C collaboration.


From: Anthony B. Coates (Nov 28 2006, at 02:12)

The King is dead. Long live The King. Actually, I'm happy to write here and now that I don't use RELAX NG professionally, nor do I want to. W3C XML Schema does a good enough job for almost everything do. Now, I work on the "data" side of things, and if I worked more on the "document" side of things (and those distinctions aren't hard, but they are real enough) I would probably be looking at RELAX NG. Not for the work that I do, though.

There are things that I can't validate with W3C XML Schema, but I can't validate those with RELAX NG either. I need Schematron or a code layer to do that, so RELAX NG wins me nothing there. RELAX NG would let me to change the content of an element based on its attribute values, but I would never do that to my users. It makes some sense for marked-up human-readable text, but no great sense, to me at least, for data-oriented applications, where it's just another avenue for developers to make errors.

As for being hard to write, I have to be honest that I learnt how to write W3C XML Schema initially by using TurboXML and seeing what it wrote. However, W3C XML Schema does have tools, and good tools, and don't find it significantly harder to write than anything else, not once you've learnt the few basics you need to get started. I certainly don't find RELAX NG instantly readable, although I'm sure it is once you get to know it. I'm sure RELAX NG is easier for people who insist on writing schemas with non-schema-aware text editors, but that's an old and diminishing minority. We can do better than that.

I think The King has some life in him yet. The rumours of his death are greatly exaggerated.

Cheers, Tony.


From: Tiago Simoes (Nov 28 2006, at 17:06)

It's just a shame there are no conversion tools from xsd to relax (Trang just does the other way around)


From: John Cowan (Nov 28 2006, at 21:23)

Actually there is a converter from WXS to RNG: the Sun RELAX NG converter at http://wwws.sun.com/software/xml/developers/relaxngconverter/ sucks in almost any schema language and outputs RNG. Unlike Trang, it doesn't preserve the detailed structure of the input schema -- it just generates an equivalent one (excepting WXS identity constraints).


From: Jay Carlson (Nov 28 2006, at 22:55)

The CORBA-on-Unicode-bypassing-firewalls crowd is going wherever their tool vendors lead them. XML is only an annoyance between them and their layered buzzword-compliant RPC. It should not be surprising that they're going to ignore what's been so tediously obvious to XML-heads for a couple of years.

As much as I'd love to see http://en.wikipedia.org/wiki/Fatality_%28Mortal_Kombat%29 applied, this may only be preaching to the converted.

Can we vote SOAP off the island now too?


From: Matti Mäki (Nov 29 2006, at 03:45)

The following Wikipedia statement may ease the burden of switching from XSD to RELAX:

"Most RELAX NG schemas can be algorithmically converted into W3C XML Schemas and even DTDs (except when using RELAX NG features not supported by those languages, as above). The reverse is not true. As such, RELAX NG can be used as a normative version of the schema, and the user can convert it to other forms for tools that do not support RELAX NG."


I don't know real source or scientifical grounds for this statement but it is intuitively believable with basic knowledge of both techniques.


From: Rick Jelliffe (Nov 29 2006, at 16:15)

I also have an XSD to RELAX NG converter, which I used for the ECMA/MicroSoft Office Open XML schema conversions. It preserves schema file structure and even keeps the same order of declarations and many comments. It is being released by Topologi.


From: Chris Lilley (Nov 29 2006, at 19:14)

Couple of comments. First on tool support - XML Spy doesn't support RNG, last I looked, but oXygen and Exchanger do. That plus libxml command line gets you a long way.

Second on W3C -vs- not. Several W3C groups have chosen RNG rather than XSD when moving away from DTDs - SVG 1.2, for example (also uses NVDL); Timed Text DFXP uses RNG; Internationalization Tag Set (ITS) offers both XSD and RNG as does XHTML 2.0. CDF plans to use RNG together with NVDL. This is not really unusual - XSD -vs- RNG largely splits along data -vs- document lines, as others have noted, and W3C document-like formats are transitioning to RNG in the same way that, say, Docbook V5 or TEI P5 have.


From: John Cowan (Nov 30 2006, at 13:52)

Well, Eliot is firmly against RELAX NG, and he's a doc-head, so let's go to http://drmacros-xml-rants.blogspot.com/2006/11/relax-wins-not-so-fast.html and pile on the comments, eh?


From: Stephen Gardener (Dec 04 2006, at 19:37)

Yeah, that's just what we need. Yet ANOTHER schema validator for XML.

DTD's didn't cut it...let's scrap 'em. The NEW silver bullet is XML Schema's

Oh wait, I don't particularly like the flavor of XML Schema's, lets make up something new.

Fix the existing standards, don't try and reinvent the wheel. Sometimes I think architects design new stuff with the express purpose of making perfectly viable EXISTING technologies obsolete (and thereby requiring more development).

It's a bad idea, bad business, and we should just stop it now.


From: Don Hopkins (Dec 04 2006, at 21:06)

I agree completely! Here are some articles I've written on Relax/NG.



Relax NG: Design-by-Inspired-Individuals vs. Design-by-Committee

In The State of XML, Edd Dumbill explains the secret behind the success of Relax NG:


Incidentally the RELAX NG success can equally well be framed as a case of design-by-inspired-individuals vs. design-by-committee as much as it can be seen as a OASIS vs. W3C thing.


Relax NG Compact Syntax: no to operator precedence, yes to annotations!


Maximizing Composability and Relax NG Trivia


From: Jacoby Thwaites (Dec 05 2006, at 01:44)

XSD + Schematron solves most of XSD's problems.


From: gaetano giunta (Dec 05 2006, at 03:12)

"Most RELAX NG schemas can be algorithmically converted into W3C XML Schemas and even DTDs (except when using RELAX NG features not supported by those languages, as above). The reverse is not true. As such, RELAX NG can be used as a normative version of the schema, and the user can convert it to other forms for tools that do not support RELAX NG."

Read carefully the part within parenthesis in the above statement.

In my very limited experience, the parts of RNG that XSD misses are very much in everyday need (eg. xmlrpc can be specced in RNG, it cannot be in XSD), while the parts that XSD adds to RNG are much overrated in usefulness. Eg, how many times does anybody really use a min-occurs, max-occurs combination that is not either 0, 1 or infinity?


From: Christian Nentwich (Dec 05 2006, at 14:57)

Hard to read and write? I don't care, I only look at it 10% of the time when I am not looking at a graphical view.

I do a lot of the same kind of stuff as Tony Coates up there ;) Which is: working with Schemas that have north of 2000 complex types. How to manage that graphically and get reuse using type inheritance is what I am interested in.

Whether RELAX provides more expressive grammars is pretty irrelevant for complex data, most of it is simple sequential containment or simple choices anyway. On the other hand, the modeling paradigm in Schema that makes people familiar with objects feel comfortable should not be discounted just like that.


From: Anonymous Coward (Dec 05 2006, at 16:30)

Apparently this:


can convert from XSD to RNG (sorry I can't find a better URL).


author · Dad
colophon · rights
picture of the day
November 27, 2006
· Technology (90 fragments)
· · XML (136 more)

By .

The opinions expressed here
are my own, and no other party
necessarily agrees with them.

A full disclosure of my
professional interests is
on the author page.

I’m on Mastodon!